Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6ccce1428ea80ac05937e2016225909ccd0a622c
Ticket: 219195ffffffffffffffffffffffffffffffffff
async Tcl_OpenTcpClient failure remains undetected
User & Date: nobody on 2000-10-26 05:03:23
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 2713 Bug
    Version: 8.0p2
    SubmitDate: '1999-09-10'
    LastModified: '1999-11-10'
    Severity: SER
    Status: Assigned
    Submitter: techsupp
    ChangedBy: hobbs
    OS: Solaris
    Machine: Other
    FixedDate: '2000-10-25'
    ClosedDate: '2000-10-25'
    
    
    Name:
    Hermann Hüni
    
    Comments:
    Is this bug already fixed in a later release of tcl?
    
    ReproducibleScript:
    static Tcl_Channel remoteServerChannel;
        
        int main()
        {
          /*
           *open client socket to remote server
           */
          remoteServerChannel = Tcl_OpenTcpClient(/* interp */ NULL,
          /* port */ remoteServerPortNb,
          /* host */ remoteServer,
          /* myaddr */ NULL, /* myport */ 0,
          /* async */ 1);
        
          if (remoteServerChannel == NULL) {
            /*
             *tcp open has failed
             */
            perror("Tcl_OpenTcpClient failed:");
            exit(-1);
          }
        
          /*
           * register establishedEvent handler for this channel
           */
          Tcl_CreateChannelHandler(remoteServerChannel,
           TCL_WRITABLE|TCL_EXCEPTION,
           establishedEvent,
           (ClientData)remoteServerChannel);
        
        }
        
        /* 
         *socket connection established Event callback
         */
        static void establishedEvent(ClientData clientData, int mask)
        {
          Tcl_Channel channel = (Tcl_Channel)clientData;
        
        {
          Tcl_DString optionString;
          Tcl_DStringInit(&optionString);
          {
            int success = Tcl_GetChannelOption(/* interp */ NULL,
               aChannel,
               /* optionName */ "-peername",
               &optionString);
        
            /* ... */
            }
          }
        }
        
        ./myClient someHost undeployedPortNumber
    
    ObservedBehavior:
    In the following usage:
        
        ./myClient someHost undeployedPortNumber
        
        the Tcl_OpenTcpClient call does not return NULL and
        the establishedEvent callback is NEVER called.
        
        How can we get to know, that the socket connection will never succeed?
        
        Here is a real trace:
        
        bash$ ./myClient butler 799999
        main; channel options are: /-blocking 1 -buffering line -buffersize 4096
        -eofchar {{} {}} -translation {auto crlf} -sockname {0.0.0.0 0.0.0.0 0}/
        
        We could check for -sockname  not beeing {0.0.0.0 0.0.0.0 0}  as a work
        around just after the
        the call to Tcl_OpenTcpClient() ?
        
        But the real place to check the success or failure should be in the
        establishedEvent() callback.
        Unfortunately, this callback does never occur. This seems to be a real
        bug.
        
        I am using tcl8.0p2 on Solaris 2.7.
        
        Democode is available uppon demand
    
    DesiredBehavior:
    The establishedEvent() callback should occur as it does, if we give an
        unreachable host.
    
    
    
    This should be tried again with 8.2.2, there have been many fixes
    in this area since 8.0p2. 
    -- 11/10/1999 hobbs
    
  4. foundin changed to: "obsolete: 8.0p2"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "63. (unused)"
  10. title changed to: "async Tcl_OpenTcpClient failure remains undetected"
  11. type changed to: "Bug"