.
D 2000-10-26T00:46:34
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s4140\sBug\nVersion:\s8.3b2\nSubmitDate:\s'2000-02-07'\nLastModified:\s'2000-02-07'\nSeverity:\sCRIT\nStatus:\sClosed\nSubmitter:\stechsupp\nChangedBy:\sericm\nRelatedBugIDs:\s4139\nOS:\sLinux\nOSVersion:\sLinux\nMachine:\si686\nFixedDate:\s'2000-10-25'\nClosedDate:\s'2000-02-07'\n\n\nName:\n\nmo\n\n\n\nCVS:\n\nFeb\s5th\n\n\n\nCustomShell:\n\nNone\n\n\n\nComments:\n\nHere\sis\sa\squick\sstack\strace\sthat\sI\sgot\sfrom\sthe\shung\sprocess.\n\n\s\s\s\s\n\n\s\s\s\s#0\s\s0x40147164\sin\s__syscall_sigsuspend\s()\n\n\s\s\s\s#1\s\s0x4016b6cc\sin\s__DTOR_END__\s()\n\n\s\s\s\s#2\s\s0x4017c513\sin\spthread_cond_wait\s(cond=0x804bf88,\smutex=0x8049f80)\sat\n\n\s\s\s\srestart.h:49\n\n\s\s\s\s#3\s\s0x4009d057\sin\sTcl_ConditionWait\s(condPtr=0x400b0c78,\n\n\s\s\s\smutexPtr=0x400b0c74,\stimePtr=0x0)\n\n\s\s\s\s\s\s\s\sat\s../../unix/tclUnixThrd.c:634\n\n\s\s\s\s#4\s\s0x4009d2a6\sin\sTcl_FinalizeNotifier\s(clientData=0x8049c58)\n\n\s\s\s\s\s\s\s\sat\s../../unix/tclUnixNotfy.c:268\n\n\s\s\s\s#5\s\s0x40078fe7\sin\sTclFinalizeNotifier\s()\sat\n\n\s\s\s\s../../generic/tclNotify.c:152\n\n\s\s\s\s#6\s\s0x40050996\sin\sTcl_FinalizeThread\s()\sat\s../../generic/tclEvent.c:878\n\n\s\s\s\s#7\s\s0x4005081e\sin\sTcl_Finalize\s()\sat\s../../generic/tclEvent.c:778\n\n\s\s\s\s#8\s\s0x400505d1\sin\sTcl_Exit\s(status=0)\sat\s../../generic/tclEvent.c:560\n\n\s\s\s\s\n\n\s\s\s\sHere\sis\sanother\squick\sbit\sof\soutput\sthat\sshows\sthe\sselect()\sproblem\n\n\s\s\s\sin\saction.\sI\sadded\ssome\sdebug\sstatements\saround\sthe\sselect()\sin\sthe\n\n\s\s\s\snotifier\sthread\sand\sgot\sthis\soutput.\n\n\s\s\s\s\n\n\s\s\s\s//\sWith\sBug\n\n\s\s\s\s\n\n\s\s\s\s%\sexit\n\n\s\s\s\s\n\n\s\s\s\s//\sHung\suntil\syou\skill\schildren\smanually\n\n\s\s\s\s\n\n\s\s\s\sNotifier\sThread\s:\sselect()\sreturned\n\n\s\s\s\sNotifier\sThread\s:\sreading\strigger\spipe\n\n\s\s\s\sNotifier\sThread\s:\scond1\s=\s32,\sdata\s=\s0,\scond2\s=\s1\n\n\s\s\s\sNotifier\sThread\s:\sreading\sEOF\son\strigger\spipe\n\n\s\s\s\s\n\n\s\s\s\s//\sWithout\sbug\n\n\s\s\s\s\n\n\s\s\s\s%\sexit\n\n\s\s\s\sNotifier\sThread\s:\sselect()\sreturned\n\n\s\s\s\sNotifier\sThread\s:\sreading\strigger\spipe\n\n\s\s\s\sNotifier\sThread\s:\scond1\s=\s32,\snumbytes\s=\s1,\sbuf\s=\s"q"\n\n\s\s\s\sNotifier\sThread\s:\strigger\spipe\swas\sclosed\n\n\n\nReproducibleScript:\n\nFirst\ssave\sthe\sfollowing\sas\sa\sfile,\sand\srun\sin\sa\sthread\senabled\sversion\n\nof\sTcl\s(I\sused\s8.3\sfrom\sthe\sCVS\sbut\sthis\sshould\shang\sothers\stoo).\n\n\n\n#\sstart\sof\sfile\s"sleepscript"\n\n\n\necho\s"while\strue\n\ndo\n\nsleep\s3\n\necho\swakeup\s\\$1\s\\$\\$\n\ndone\n\n"\s>\s/tmp/sleepscript\n\n\n\n/bin/sh\s/tmp/sleepscript\schild\s&\n\n\n\nexec\s/bin/sh\s/tmp/sleepscript\sparent\n\n\n\n#\send\sof\sfile\s"sleepscript"\n\n\n\n\n\nNow\srun\sthe\sfollowing\scommands\sin\sthe\sTcl\sshell.\n\n\n\nexec\s/bin/sh\ssleepscript\s&\n\n\n\nexit\n\n\n\nObservedBehavior:\n\nAfter\sexit\sis\scalled,\sTcl\swill\shang.\sIf\syou\smanually\skill\soff\sthe\n\nsubprocesses\sthat\swere\sexec'ed,\sthe\sscript\swill\sfinish\safter\seach\n\nsubprocess\shas\sterminated.\n\n\n\nDesiredBehavior:\n\nThe\sTcl\sscript\sshould\sexit.\n\n\n\nPatch:\n\nIndex:\sunix/tclUnixNotfy.c\n\n===================================================================\n\nRCS\sfile:\s/cvsroot/tcl/unix/tclUnixNotfy.c,v\n\nretrieving\srevision\s1.7\n\ndiff\s-u\s-r1.7\stclUnixNotfy.c\n\n---\stclUnixNotfy.c2000/01/21\s02:26:251.7\n\n+++\stclUnixNotfy.c2000/02/07\s20:05:20\n\n@@\s-264,7\s+264,20\s@@\n\n\sif\s(triggerPipe\s<\s0)\s{\n\n\s\s\s\s\spanic("Tcl_FinalizeNotifier:\snotifier\spipe\snot\sinitialized");\n\n\s}\n\n+\n\n+/*\sSend\s"q"\smessage\sto\sthe\snotifier\sthread\sso\sthat\sit\swill\n\n+\s\s\sterminate.\sThe\snotifier\swill\sreturn\sfrom\sits\scall\sto\n\n+\s\s\sselect()\sand\snotice\sthat\sa\s"q"\smessage\shas\sarrived,\sit\n\n+\s\s\swill\sthen\sclose\sits\sside\sof\sthe\spipe\sand\sterminate\sits\n\n+\s\s\sthread.\sNote\sthe\swe\scan\snot\sjust\sclose\sthe\spipe\sand\scheck\n\n+\s\s\sfor\sEOF\sin\sthe\snotifier\sthread\sbecause\sif\sa\sbackground\n\n+\s\s\schild\sprocess\swas\screated\swith\sexec,\sselect()\swould\snot\n\n+\s\s\sregister\sthe\sEOF\son\sthe\spipe\suntil\sthe\schild\sprocesses\n\n+\s\s\shad\sterminated.\n\n+*/\n\n+write(triggerPipe,\s"q",\s1);\n\n\sclose(triggerPipe);\n\n+\n\n\sTcl_ConditionWait(¬ifierCV,\s¬ifierMutex,\sNULL);\n\n\s\s\s\s\s}\n\n\s\n\n@@\s-991,10\s+1004,11\s@@\n\n\s\s*\sto\savoid\sa\srace\scondition\swe\sonly\sread\sone\sat\sa\stime.\n\n\s\s*/\n\n\s\n\n-if\s((masks[index]\s&\sbit)\s&&\s(read(receivePipe,\sbuf,\s1)\s==\s0))\s{\n\n+if\s((masks[index]\s&\sbit)\s&&\n\n+\s\s\s\s\s\s\s\s\s\s\s\s((read(receivePipe,\sbuf,\s1)\s==\s1)\s&&\sbuf[0]\s==\s'q'))\s{\n\n\s\s\s\s\s/*\n\n-\s\s\s\s\s*\sSomeone\sclosed\sthe\swrite\send\sof\sthe\spipe\sso\swe\sneed\sto\n\n-\s\s\s\s\s*\sshut\sdown\sthe\snotifier\sthread.\n\n+\s\s\s\s\s*\sSomeone\ssent\sus\sa\sQuit\smessage\sand\sclosed\sthe\swrite\send\n\n+\s\s\s\s\s*\sof\sthe\spipe\sso\swe\sneed\sto\sshut\sdown\sthe\snotifier\sthread.\n\n\s\s\s\s\s\s*/\n\n\s\n\n\s\s\s\s\sbreak;\n\nIndex:\sunix/tclUnixThrd.c\n\n===================================================================\n\nRCS\sfile:\s/cvsroot/tcl/unix/tclUnixThrd.c,v\n\nretrieving\srevision\s1.7\n\ndiff\s-u\s-r1.7\stclUnixThrd.c\n\n---\stclUnixThrd.c2000/01/12\s11:13:561.7\n\n+++\stclUnixThrd.c2000/02/07\s20:05:20\n\n@@\s-340,7\s+340,7\s@@\n\n\sMASTER_LOCK;\n\n\sif\s(*mutexPtr\s==\sNULL)\s{\n\n\s\s\s\s\s/*\s\n\n-\s\s\s\s\s*\sDouble\sinside\smaster\slock\scheck\sto\savoid\sa\srace.\n\n+\s\s\s\s\s*\sDouble\scheck\sinside\smaster\slock\sto\savoid\sa\srace\scondition.\n\n\s\s\s\s\s\s*/\n\n\s\s\s\s\s\n\n\s\s\s\s\spmutexPtr\s=\s(pthread_mutex_t\s*)ckalloc(sizeof(pthread_mutex_t));\n\n@@\s-358,7\s+358,7\s@@\n\n\s/*\n\n\s\s*----------------------------------------------------------------------\n\n\s\s*\n\n-\s*\sTclpMutexUnlock\s--\n\n+\s*\sTcl_MutexUnlock\s--\n\n\s\s*\n\n\s\s*This\sprocedure\sis\sinvoked\sto\sunlock\sa\smutex.\s\sThe\smutex\smust\n\n\s\s*have\sbeen\slocked\sby\sTcl_MutexLock.\n\n\n\nPatchFiles:\n\nunix/tclUnixNotfy.c\n\n\s\s\s\sunix/tclUnixThrd.c\s(minor\scomment\scleanup\sonly)\n\n\n\n\n\n
J foundin obsolete:\s8.3b2
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 69.\sOther
J title bg\sexec\scauses\sTcl\sto\shang\son\sexit\sunder\sLinux
J type Bug
K 217956ffffffffffffffffffffffffffffffffff
U nobody
Z 593dc2bce95f279092502fd293cfde94