<i>socket_*-12.3 crashes on Windows 11</i> status still Open with 3 other changes
by
.
D 2026-05-28T06:40:09.777
J icomment Managed\sto\sreliably\sreproduce\sby\srunning\sthe\stests\scontinuously.\sFails\swithin\s30\siterations\sdue\sto\suse\safter\sfree.\sThe\sbug\sis\spresent\sin\srelease\sbuilds\sas\swell\sbut\sshows\sup\smore\seasily\sin\sdebug\sbuilds\sbecause\sthe\sC\sucrt/msvcrt\sruntimes\sscrub\smemory\sonly\sin\sdebug\sbuilds.\r\n\r\nProposed\sfix\sis\sin\sthe\sbug-06f19cc4-with-tcltest\sbranch.\s\r\n\r\nDiagnosis:\sThe\ssocket\simplementation\sof\sWindows\smaintains\sa\sseparate\s"socket\sthread"\sfor\sa\sTcl\sthread\sto\shandle\ssocket\sI/O.\sThe\slist\sof\slive\ssockets\sis\smaintained\sin\sa\sTSD\slist\swithin\sthe\sTcl\sthread\sand\salso\sshared\swith\sthe\ssocket\sthread.\sWhen\sa\schannel\sis\sin\snormal\soperation,\sthe\ssocket\sstate\sstructure\sis\sremoved\sfrom\sthis\slist\svia\sthe\ssocket\schannel\simplementation's\sThreadActionProc\s(via\sa\sCutChannel\scall).\sHowever,\swhen\sa\sthread\sexits,\sTclFinalizeIOSubsystem\sfrees\sthe\ssocket\sstate\sstructure\swithout\scalling\sCutChannel.\sThe\ssocket\sthread\sstill\shas\saccess\sto\sit\svia\sthe\sshared\slist\sand\sdepending\son\swhen\sthe\ssocket\sclosure\swindows\smessage\sis\sreceived,\saccesses\sthe\sfreed\smemory.\r\n\r\nThe\sfix\ssimply\sadds\sa\sCutChannel\sto\sTclFinalizeIOSubsystem\sprior\sto\sthe\sChanClose.\sI\sbelieve\sthis\sshould\sapply\sto\sall\splatforms\sbut\sI'm\snot\ssure\sof\sthe\sUnix\simplementations\sso\sit's\sifdef'ed\sto\sWIN32.\r\n\r\nAlthough\sa\sone-liner,\sit's\salso\sa\sfairly\slow\slevel\schange\sthat\sneeds\ssubstantial\sairtime\sfor\san\sissue\sthat\sonly\sarises\son\sthread\sexits\swith\sopen\ssockets\sso\sdo\snot\sthink\sit\sshould\sbe\sbackported\sto\s9.0.4.\r\n\r\nReviews\swelcomed.
J login apnadkarni
J mimetype text/x-markdown
K 06f19cc401de076eea76538424796d1ee54ed221
U apnadkarni
Z 481131ace0111706b93671fd248ced72