.
D 2000-10-26T05:10:23
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s2661\sBug\nVersion:\s8.2\nSubmitDate:\s'1999-08-31'\nLastModified:\s'1999-12-17'\nSeverity:\sMED\nStatus:\sUnAssn\nSubmitter:\stechsupp\nChangedBy:\shobbs\nOS:\sSolaris\nOSVersion:\s2.6\nMachine:\sOther\nFixedDate:\s'2000-10-25'\nClosedDate:\s'2000-10-25'\n\n\nName:\nMichael\sSantos\n\nReproducibleScript:\nChannel\sevent\shandlers\sare\snever\sinvoked\sfor\sa\sTCP\sserver\ssocket\seven\n\s\s\s\sthough\sTcl_DoOneEvent\sis\scalled\sto\scheck\sfor\sall\sevents\swhen\sthe\sserver\n\s\s\s\sis\srunning\son\sa\sremote\smachine\svia\sssh.\s\sThis\sis\sa\smodification\sof\smy\n\s\s\s\sprevious\sbug\sreport\sprogram.\s\sWhen\slinked\swith\sTcl\scompiled\swith\sthread\n\s\s\s\ssupport,\sthe\sConnectPort\sfunction\swill\snever\sbe\sinvoked\sin\sresponse\sto\sa\n\s\s\s\sconnection,\seven\sthough\sthe\sprocess\sconnecting\sto\sthe\sincluded\sprogram\n\s\s\s\ssees\sthat\sthe\sconnection\sis\sestablished.\s\sI\sguess\san\saccept\sin\sdone\son\n\s\s\s\sthe\sunderlying\ssocket,\sbut\sthe\shandler\sassociated\swith\sit\sis\snever\srun.\n\s\s\s\sWhen\slinked\sagainst\sTcl\swithout\sthread\ssupport,\severything\sworks\n\s\s\s\scorrectly.\s\sSimilarly,\sif\sthe\sserver\sis\srun\son\sa\sremote\smachine\svia\srsh\n\s\s\s\sinstead\sof\sssh,\severything\sworks\scorrectly.\s\sPerhaps\sthis\sis\sreally\sa\n\s\s\s\sbug\sin\sssh;\sI\sdon't\sknow.\n\s\s\s\s\n\s\s\s\sTo\stest,\scompile\sthe\sprogram\sbelow:\scall\sit\sserver.\s\sssh\sinto\sanother\n\s\s\s\smachine\sand\srun\sthe\sserver\sin\sthe\ssupplied\sshell.\s\sOn\sthe\slocal\smachine,\n\s\s\s\sfire\sup\sTcl\sand\sconnect\sto\sthe\sserver\svia\s"socket\s<remote\smachine>\n\s\s\s\s50099".\s\sConnectPort\swill\salmost\salways\snot\sbe\sinvoked.\s\sOccassionally,\n\s\s\s\sI\shave\sseen\sit\sinvoked\smany\s(20-30)\scalls\sto\sTcl_DoOneEvent\slater.\n\s\s\s\s\n\s\s\s\sThe\ssample\sC\sfile\sfollows.\s\sThe\sexecutable\stakes\sa\ssingle\sargument\sthat\n\s\s\s\scontrols\show\squickly\sTcl\schecks\sfor\sevents.\s\s\n\s\s\s\s\n\s\s\s\s#include\s<stdio.h>\n\s\s\s\s#include\s<tcl.h>\n\s\s\s\s\n\s\s\s\sTcl_Interp\s*gInterp;\n\s\s\s\s\n\s\s\s\svoid\n\s\s\s\sReadData(ClientData\sclientData,\sint\smask)\s{\n\s\s\s\s\s\schar\sbuf[256];\n\s\s\s\s\s\sfprintf(stderr,\s"ReadData()\scalled\\n");\n\s\s\s\s\s\swhile\s(Tcl_Read((Tcl_Channel)clientData,\sbuf,\s255)\s>\s0)\s;\n\s\s\s\s\s\sTcl_Close(gInterp,\s(Tcl_Channel)clientData);\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\s\n\s\s\s\svoid\s\n\s\s\s\sConnectPort(ClientData\sclientData,\sTcl_Channel\snew_socket,\n\s\s\s\s\s\s\s\schar\s*hostName,\sint\sport)\s{\n\s\s\s\s\s\sfprintf(stderr,\s"ConnectPort()\scalled\swith\shostname\s%s,\sport\s%d\\n",\n\s\s\s\s\s\shostName,\sport);\n\s\s\s\s\s\sif\s(Tcl_SetChannelOption(gInterp,\snew_socket,\n\s\s\s\s\s\s\s"-buffering",\s"none")\s!=\sTCL_OK)\s{\n\s\s\s\s\s\s\s\sfprintf(stderr,\s"Error\ssetting\sbuffering\soption\son\sTCL\ssocket.\\n");\n\s\s\s\s\s\s\s\sabort();\n\s\s\s\s\s\s}\n\s\s\s\s\s\sif\s(Tcl_SetChannelOption(gInterp,\snew_socket,\n\s\s\s\s\s\s\s"-translation",\s"binary")\s!=\sTCL_OK)\s{\n\s\s\s\s\s\s\s\sfprintf(stderr,\s"Error\ssetting\stranslation\soption\son\sTCL\s"\n\s\s\s\s\s\s\s\s"socket.\\n");\n\s\s\s\s\s\s\s\sabort();\n\s\s\s\s\s\s}\n\s\s\s\s\s\sif\s(Tcl_SetChannelOption(gInterp,\snew_socket,\n\s\s\s\s\s\s\s"-blocking",\s"FALSE")\s!=\sTCL_OK)\s{\n\s\s\s\s\s\s\s\sfprintf(stderr,\s"Error\ssetting\sblocking\soption\son\sTCL\ssocket.\\n");\n\s\s\s\s\s\s\s\sabort();\n\s\s\s\s\s\s}\n\s\s\s\s\n\s\s\s\s\s\sTcl_CreateChannelHandler(new_socket,\sTCL_READABLE,\sReadData,\s\n\s\s\s\s\s\s\s(ClientData)new_socket);\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\s\n\s\s\s\svoid\n\s\s\s\sStartServer(ClientData\sclientData)\s{\n\s\s\s\s\s\sTcl_Channel\ssocket;\n\s\s\s\s\s\sfprintf(stderr,\s"StartServer()\scalled.\\n");\n\s\s\s\s\s\ssocket\s=\s\n\s\s\s\s\s\s\s\sTcl_OpenTcpServer(gInterp,\s50099,\sNULL,\s\n\s\s\s\s\s\s\s\s\s\sConnectPort,\s(ClientData)NULL);\n\s\s\s\s\s\sif\s(!socket)\s{\n\s\s\s\s\s\s\s\sTcl_Exit(1);\n\s\s\s\s\s\s}\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\s\n\s\s\s\sint\s\n\s\s\s\sTcl_AppInit(Tcl_Interp\s*interp)\s{\n\s\s\s\s\s\sgInterp\s=\sinterp;\n\s\s\s\s\s\sif\s(Tcl_Init(interp)\s!=\sTCL_OK)\s{\n\s\s\s\s\s\s\s\sfprintf(stderr,\s"Tcl\sfailed\sto\sinitialize.\\n");\n\s\s\s\s\s\s\s\sTcl_Exit(1);\n\s\s\s\s\s\s}\n\s\s\s\s\n\s\s\s\s\s\sStartServer(NULL);\n\s\s\s\s\n\s\s\s\s\s\sreturn\sTCL_OK;\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\s\n\s\s\s\sint\s\n\s\s\s\smain(int\sargc,\schar\s*argv[])\s{\n\s\s\s\s\s\sint\si;\n\s\s\s\s\n\s\s\s\s\s\sgInterp\s=\sTcl_CreateInterp();\n\s\s\s\s\s\sTcl_AppInit(gInterp);\n\s\s\s\s\n\s\s\s\s\s\swhile\s(1)\s{\n\s\s\s\s\s\s\s\sfor\s(i\s=\s0;\si\s<\satoi(argv[1]);\si++)\s;\n\s\s\s\s\s\s\s\sfprintf(stderr,\s"Checking\sfor\sevents.\\n");\n\s\s\s\s\s\s\s\swhile\s(Tcl_DoOneEvent(TCL_DONT_WAIT))\s{\n\s\s\s\s\s\s\s\s\s\s/*\sEmpty\swhile\sloop\s*/\n\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s}\n\s\s\s\s\s\sreturn\s0;\n\s\s\s\s}\n\nObservedBehavior:\nWhen\sa\sserver\ssocket\sis\sopened\son\sthe\sother\send\sof\san\sssh\sconnection,\n\s\s\s\sfile\sevents\sare\simproperly\srecognized\s--\susually\signored,\sbut\ssometime\n\s\s\s\sgreatly\sdeferred.\s\sIt\sseems\sto\sbe\srelated\sto\sssh's\sport\sforwarding\n\s\s\s\sfeature,\sas\sconnecting\swith\s"ssh\s-x",\swhich\sdisables\sthe\sX11\sforwarding,\n\s\s\s\sleads\sto\scorrect\sbehavior.\n\nDesiredBehavior:\nI\swould\sexpect\sthat\sthe\sconnection\swould\swork\sregardless\sof\swhether\sssh\n\s\s\s\sis\sforwarding\sX11\straffic\sand\swhether\sor\snot\sTcl\sis\scompiled\swith\n\s\s\s\sthreads\ssupport.\s\sFor\ssome\sreason,\sonly\sthe\sthreaded\sversion\sseems\sto\sbe\n\s\s\s\saffected\sby\sssh's\sX11\sport\sforwarding.\n\n\n\n
J foundin obsolete:\s8.2
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 49.\sThreading
J title SSH\sand\sthreaded\sTcl:\sfile\sevents\sget\smissed
J type Bug
K 219302ffffffffffffffffffffffffffffffffff
U nobody
Z 3b6fe2272d0f34b226dfccbf86dc45e7