Skip to content
Tcl Source Code History Of Ticket 219302
Login

History Of Ticket 219302

Artifacts Associated With Ticket 219302

  1. Ticket change [bbe19a10c9] (rid 129563) by nobody on 2000-10-26 05:10:23:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 2661 Bug
      Version: 8.2
      SubmitDate: '1999-08-31'
      LastModified: '1999-12-17'
      Severity: MED
      Status: UnAssn
      Submitter: techsupp
      ChangedBy: hobbs
      OS: Solaris
      OSVersion: 2.6
      Machine: Other
      FixedDate: '2000-10-25'
      ClosedDate: '2000-10-25'
      
      
      Name:
      Michael Santos
      
      ReproducibleScript:
      Channel event handlers are never invoked for a TCP server socket even
          though Tcl_DoOneEvent is called to check for all events when the server
          is running on a remote machine via ssh.  This is a modification of my
          previous bug report program.  When linked with Tcl compiled with thread
          support, the ConnectPort function will never be invoked in response to a
          connection, even though the process connecting to the included program
          sees that the connection is established.  I guess an accept in done on
          the underlying socket, but the handler associated with it is never run.
          When linked against Tcl without thread support, everything works
          correctly.  Similarly, if the server is run on a remote machine via rsh
          instead of ssh, everything works correctly.  Perhaps this is really a
          bug in ssh; I don't know.
          
          To test, compile the program below: call it server.  ssh into another
          machine and run the server in the supplied shell.  On the local machine,
          fire up Tcl and connect to the server via "socket <remote machine>
          50099".  ConnectPort will almost always not be invoked.  Occassionally,
          I have seen it invoked many (20-30) calls to Tcl_DoOneEvent later.
          
          The sample C file follows.  The executable takes a single argument that
          controls how quickly Tcl checks for events.  
          
          #include <stdio.h>
          #include <tcl.h>
          
          Tcl_Interp *gInterp;
          
          void
          ReadData(ClientData clientData, int mask) {
            char buf[256];
            fprintf(stderr, "ReadData() called\n");
            while (Tcl_Read((Tcl_Channel)clientData, buf, 255) > 0) ;
            Tcl_Close(gInterp, (Tcl_Channel)clientData);
          }
          
          
          void 
          ConnectPort(ClientData clientData, Tcl_Channel new_socket,
              char *hostName, int port) {
            fprintf(stderr, "ConnectPort() called with hostname %s, port %d\n",
            hostName, port);
            if (Tcl_SetChannelOption(gInterp, new_socket,
             "-buffering", "none") != TCL_OK) {
              fprintf(stderr, "Error setting buffering option on TCL socket.\n");
              abort();
            }
            if (Tcl_SetChannelOption(gInterp, new_socket,
             "-translation", "binary") != TCL_OK) {
              fprintf(stderr, "Error setting translation option on TCL "
              "socket.\n");
              abort();
            }
            if (Tcl_SetChannelOption(gInterp, new_socket,
             "-blocking", "FALSE") != TCL_OK) {
              fprintf(stderr, "Error setting blocking option on TCL socket.\n");
              abort();
            }
          
            Tcl_CreateChannelHandler(new_socket, TCL_READABLE, ReadData, 
             (ClientData)new_socket);
          }
          
          
          void
          StartServer(ClientData clientData) {
            Tcl_Channel socket;
            fprintf(stderr, "StartServer() called.\n");
            socket = 
              Tcl_OpenTcpServer(gInterp, 50099, NULL, 
                ConnectPort, (ClientData)NULL);
            if (!socket) {
              Tcl_Exit(1);
            }
          }
          
          
          int 
          Tcl_AppInit(Tcl_Interp *interp) {
            gInterp = interp;
            if (Tcl_Init(interp) != TCL_OK) {
              fprintf(stderr, "Tcl failed to initialize.\n");
              Tcl_Exit(1);
            }
          
            StartServer(NULL);
          
            return TCL_OK;
          }
          
          
          int 
          main(int argc, char *argv[]) {
            int i;
          
            gInterp = Tcl_CreateInterp();
            Tcl_AppInit(gInterp);
          
            while (1) {
              for (i = 0; i < atoi(argv[1]); i++) ;
              fprintf(stderr, "Checking for events.\n");
              while (Tcl_DoOneEvent(TCL_DONT_WAIT)) {
                /* Empty while loop */
              }
            }
            return 0;
          }
      
      ObservedBehavior:
      When a server socket is opened on the other end of an ssh connection,
          file events are improperly recognized -- usually ignored, but sometime
          greatly deferred.  It seems to be related to ssh's port forwarding
          feature, as connecting with "ssh -x", which disables the X11 forwarding,
          leads to correct behavior.
      
      DesiredBehavior:
      I would expect that the connection would work regardless of whether ssh
          is forwarding X11 traffic and whether or not Tcl is compiled with
          threads support.  For some reason, only the threaded version seems to be
          affected by ssh's X11 port forwarding.
      
      
      
      
      
    4. foundin initialized to: "obsolete: 8.2"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "49. Threading"
    10. title initialized to: "SSH and threaded Tcl: file events get missed"
    11. type initialized to: "Bug"
  2. Ticket change [8fe500ae5d] (rid 120351) by hobbs on 2002-03-23 05:08:07:

    1. closedate changed to: "2002-03-22T22:08:07"
    2. closer changed to: "hobbs"
    3. icomment:
      Logged In: YES 
      user_id=72656
      
      This appears to be a dup of 219301
      
      
    4. login: "hobbs"
    5. mimetype: "text/plain"
    6. resolution changed to: "Duplicate"
    7. status changed to: "Closed"
    8. username: "hobbs"