Skip to content
Tcl Source Code Artifact [df52774e8f]
Login

Artifact [df52774e8f]

Artifact df52774e8fef7e6f11928abc3986b725bbc37ccb:

Ticket change [df52774e8f] - Ticket [3545365fffffffff|3545365fff] <i>Crash in io-29.33b (no implicit flush of nonblocking on exit</i> status still Open with 4 other changes by twylite on 2012-07-25 00:57:02.
D 2012-07-25T00:57:02
J icomment No\sfix\syet.\s\sI've\shad\sto\sdelve\sdeeper\sinto\show\sthis\sfile\sworks,\sand\sit's\sconfirming\smy\ssuspicions.\s\sThe\spipe\shandles\sare\snot\sopened\swith\sFILE_FLAG_OVERLAPPED,\swhich\smeans\sthey're\sblocking.\s\sThis\sallows\sfor\ssimple\sblocking\soperations\sin\sthe\smain\sthread\swhen\s(!\sPIPE_ASYNC),\sbut\smeans\sthat\swhen\swe're\sin\sasync\smode\sthe\swrite\sis\stransferred\sto\sthe\swriteThread\swhere\sWriteFile()\sis\sblocking.\n\nEnter\shttp://msdn.microsoft.com/en-us/library/windows/desktop/aa365683(v=vs.85).aspx,\swhich\sconfirms\sthat\sa\sCloseHandle()\sin\sone\sthread\swill\snot\sin\sfact\sinterrupt\ssynchronous\sIO\son\sthe\shandle\sin\sanother\sthread.\s\s\n\nOn\sWindows\s2008\sor\sWindows\s7\swe\scan\suse\sCancelSynchronousIo(pipePtr->writeThread)\sbefore\sthe\sCloseHandle\sto\sremedy\sthe\ssituation\s(io-29.33b\srun\s100\stimes\sin\sa\sloop,\sall\spass).\s\sBut\sthere\sis\sno\sequivalent\sfunction\spre-Win2008.\n\nIf\sI\sput\sa\sTcl_Panic\sin\sthe\s(WriteFile()\s==\sFALSE)\sbranch\sof\sthe\sPipeWriterThread,\sI\snever\shit\sit,\sunless\sI\sdo\sa\sCancelSynchronousIo.\n\nA\sTcl_Panic\safter\sthe\sWaitForSingleObject(pipePtr->writable,\sINFINITE);\sin\sPipeClose2Proc()\soften\sreveals\sthat\sthe\swriteThread\sis\sgone.\s\sThis\smeans\sthat\sthe\sSetEvent(pipePtr->stopWriter)\shas\swoken\sthe\sthread\sfrom\sa\sWaitForMultipleObjects,\sand\sthe\sthread\shas\sthen\sterminated\s(without\ssignalling\sinfoPtr->writable,\sbecause\sit\sdoesn't\sdo\sthat\sif\swoken\sby\sstopWriter).\s\sAdding\sa\ssignal\sto\sprevent\sthis\sspecific\sblock\smakes\sthe\sdetection\swindow\sfor\sthe\sbug\snarrower,\sbut\sdoesn't\ssolve\sit.\n\nAccording\sto\smy\scurrent\sunderstanding\sthere\sis\sno\ssolution\swithout\sa\sredesign\sto\sallow\sWriteFile\sto\sbe\snon-blocking\sin\sthe\swriteThread.\n\nI'll\scontinue\slooking\sat\sthe\sproblem\stomorrow,\sand\ssee\sif\sI\scan\sconfirm\sall\sthese\sdetails,\sand\sif\sthere\sis\sa\sworkable\ssolution\s(or\sjust\sattempt\sto\sminimize\sthe\sbug\swindow).\n\n
J login twylite
J mimetype text/plain
J username twylite
K 3545365fffffffffffffffffffffffffffffffff
U twylite
Z d5296b6abe56ccf06b0ffdc1a4cf639a