Skip to content
Tcl Source Code Artifact [12abe78234]
Login

Artifact [12abe78234]

Artifact 12abe7823499d448f67039f9422666c1adff9ee20693a9c021cbdc49bc987c2c:

Ticket change [12abe78234] - Ticket [72814c7ef162e03e|72814c7ef1] <i>Tcl 8.6.7 - Tcl 8.6.13 socket.test hang intermittently on Windows 10</i> status still Open with 3 other changes by apnadkarni on 2023-10-22 15:26:24.
D 2023-10-22T15:26:24.763
J icomment Reproducing\sby\srunning\sthe\stest\ssuite\sin\sa\sloop,\shere\sis\swhat\sI\ssee.\sThe\smain\sthread\sis\sblocked\sin\s[TclPipeThreadStop](https://core.tcl-lang.org/tcl/file?ci=584bb57e0b7ce85b&name=win/tclWinPipe.c&ln=3600)\swaiting\sfor\sthe\sconsole\sreader\sthread\sto\sexit.\sThe\sstack:\s\r\n\r\n```\r\nntdll.dll!00007ff99256e234()\r\nKernelBase.dll!00007ff98ff957c2()\r\ntcl86t.dll!TclPipeThreadStop(TclPipeThreadInfo\s*\s*\spipeTIPtr,\svoid\s*\shThread)\sLine\s3600\r\n\tat\sd:\\src\\tcltk\\core-8-6-branch\\tcl\\win\\tclWinPipe.c(3600)\r\ntcl86t.dll!ConsoleCloseProc(void\s*\sinstanceData,\sTcl_Interp\s*\sinterp)\sLine\s547\r\n\tat\sd:\\src\\tcltk\\core-8-6-branch\\tcl\\win\\tclWinConsole.c(547)\r\ntcl86t.dll!ChanClose(Channel\s*\schanPtr,\sTcl_Interp\s*\sinterp)\sLine\s362\r\n\tat\sd:\\src\\tcltk\\core-8-6-branch\\tcl\\generic\\tclIO.c(362)\r\ntcl86t.dll!TclFinalizeIOSubsystem()\sLine\s677\r\n\tat\sd:\\src\\tcltk\\core-8-6-branch\\tcl\\generic\\tclIO.c(677)\r\ntcl86t.dll!FinalizeThread(int\squick)\sLine\s1320\r\n\tat\sd:\\src\\tcltk\\core-8-6-branch\\tcl\\generic\\tclEvent.c(1320)\r\ntcl86t.dll!Tcl_Exit(int\sstatus)\sLine\s995\r\n\tat\sd:\\src\\tcltk\\core-8-6-branch\\tcl\\generic\\tclEvent.c(995)\r\ntcl86t.dll!Tcl_ExitObjCmd(void\s*\sdummy,\sTcl_Interp\s*\sinterp,\sint\sobjc,\sTcl_Obj\s*\sconst\s*\sobjv)\sLine\s1036\r\n\tat\sd:\\src\\tcltk\\core-8-6-branch\\tcl\\generic\\tclCmdAH.c(1036)\r\ntcl86t.dll!Dispatch(void\s*\s*\sdata,\sTcl_Interp\s*\sinterp,\sint\sresult)\sLine\s4503\r\n\tat\sd:\\src\\tcltk\\core-8-6-branch\\tcl\\generic\\tclBasic.c(4503)\r\ntcl86t.dll!TclNRRunCallbacks(Tcl_Interp\s*\sinterp,\sint\sresult,\sNRE_callback\s*\srootPtr)\sLine\s4538\r\n\tat\sd:\\src\\tcltk\\core-8-6-branch\\tcl\\generic\\tclBasic.c(4538)\r\ntcl86t.dll!TclEvalObjEx(Tcl_Interp\s*\sinterp,\sTcl_Obj\s*\sobjPtr,\sint\sflags,\sconst\sCmdFrame\s*\sinvoker,\sint\sword)\sLine\s6104\r\n\tat\sd:\\src\\tcltk\\core-8-6-branch\\tcl\\generic\\tclBasic.c(6104)\r\n\r\n```\r\n\r\nThe\sConsoleReader\sthread\sis\sblocked\son\s[ReadConsole](https://core.tcl-lang.org/tcl/file?ci=584bb57e0b7ce85b&name=win/tclWinConsole.c&ln=225)\swith\sthe\sstack\r\n\r\n```\r\nntdll.dll!00007ff99256d0c4()\r\nKernelBase.dll!00007ff98fe87861()\r\nKernelBase.dll!00007ff98ff90e4b()\r\nKernelBase.dll!00007ff98ff90eda()\r\ntcl86t.dll!ReadConsoleBytes(void\s*\shConsole,\svoid\s*\slpBuffer,\sunsigned\slong\snbytes,\sunsigned\slong\s*\snbytesread)\sLine\s225\r\n\tat\sd:\\src\\tcltk\\core-8-6-branch\\tcl\\win\\tclWinConsole.c(225)\r\ntcl86t.dll!ConsoleReaderThread(void\s*\sarg)\sLine\s1150\r\n\tat\sd:\\src\\tcltk\\core-8-6-branch\\tcl\\win\\tclWinConsole.c(1150)\r\nkernel32.dll!00007ff9911b7344()\r\nntdll.dll!00007ff9925226b1()\r\n\r\n```\r\n\r\nThe\sabove\sare\sthe\sonly\stwo\sthreads\srunning.\r\n\r\nIn\smy\scase\sat\sleast,\shitting\sReturn\sa\sfew\stimes\sunblocks\sthe\sConsoleReader\sthread\sallowing\sthe\sprocess\sto\sexit.\r\n\r\nFirst,\sI\sdo\snot\sthink\sthis\sis\san\sissue\swith\ssockets\sat\sall,\sthe\ssocket\stests\sjust\strigger\sthe\sbug\srelated\sto\sfinalization\sof\sthe\sconsole\sthreads.\r\n\r\nSecond,\sI\sdo\snot\ssee\show\sthe\ssynchronization\sduring\sfinalization\sis\ssupposed\sto\swork.\sWhat\sunblocks\sthe\sReadConsole\scall\sshown\son\sthe\sstack\sabove?\sOn\solder\ssystems\s(like\sXP,\s2003,\swhich\s8.6\ssupports)\s,\sthe\sWin32\sCancelSyncIo\sapi\sdoes\snot\sexist.\sSecond,\seven\sif\sit\sdid,\sthere\sis\sa\srace\scondition,\showever\ssmall,\sbetween\sthe\sCancelSyncIO\sin\sthe\smain\sthread\sand\sthe\sReadConsole\sin\sthe\sconsole\sreader\sthread.\sIf\sthe\slatter\shappens\safter\sthe\sformer\sbut\sbefore\sthe\sclose\shandle\s(in\sthe\smain\sthread)\sit\swill\sstill\sblock.\s\r\n\r\nThird,\seven\sif\sit\sunblocks,\safaict\sit\swill\ssee\sa\sERROR_OPERATION_ABORTED\sand\sjust\sloop\saround\sand\sblock\sagain.\r\n\r\nSergey\sis\sof\scourse\sfar\smore\scompetent\sis\sthese\smatters\sand\shopefully\she\scan\sfind\sa\ssolution.\r\n\r\nNote\sthe\swindows\sconsole\sin\s8.7\sis\scompletely\srewritten\sso\sin\stheory\sshould\snot\sbe\saffected\sby\sthis.\sIt\swould\sbe\suseful\sif\s@szhong\scould\stest\s8.7\son\shis\ssystem\sto\sverify\sit\sis\snot\ssubject\sto\sthis\s"hang".
J login apnadkarni
J mimetype text/x-markdown
K 72814c7ef162e03e4261a0236f4f03efc8c51372
U apnadkarni
Z bdf7e410b960eec5d8d5bff56cdb0377