: <i>Memory corruption transferring server (listening) sockets between threads</i> plus 5 other changes
by
.
D 2020-05-29T20:23:04.480
J assignee apnadkarni
J icomment Although\sit\sis\sfixed\sin\sbranch\s[./timeline?r=bug-75d525d37c-sf-chan-transfer|[bug-75d525d37c-sf-chan-transfer]]\snow\s(platform-unrelated),\sthe\sfix\sis\sa\sbit\stricky:\ssince\sas\sAshok\scorrectly\ssaid,\sTcl-API\sdoesn't\sprovide\sany\spossibility\sto\sinform\ssocket\sthat\sthis\sgoing\sattached\sto\ssome\sinterpreter.<br/>\r\nSo\sone\scould\sreset\sinterp\sin\saccept-data\sby\sthread\s(interp)\sdetach,\sbut\sit\sis\simpossible\sto\sbe\sinformed\sthat\sit\sis\sattached\sagain.\r\n\r\nCheck-in\s[455c680c3a]\sprovides\snow\ssuch\sinformation\s(interp\sset\sin\sstatePtr\sof\sthe\schannel\snow),\sthat\sallows\sto\suse\sthis\sin\severy\ssocket\shandler,\swith\sprerequisite\sthat\ssocket\swould\sbe\snot\sshared\sin\smultiple\sinterpreter\sof\ssame\sthread,\sor\s(like\saccept\shandler\sof\sserver\ssocket)\sit\sdoes\snot\sintended\sto\sbe\sused\sin\sall\sinterpreters.\r\n\r\nThis\salso\sallows\sextremely\ssimplify\sthe\s(un)registering\smechanism\sof\ssocket\shandlers\s(like\saccept-proc\sand\sits\sclient-data)\sand\sit\scould\sbe\sprotected\sby\s<code>(statePtr->interp\s==\sNULL)</code>\sinside\shandler\sand/or\ssimple\sref-counter\snow.\r\n\r\nTest,\ssimilar\sto\sattached\sby\sapn,\sthat\sillustrating\sthe\sbug,\sis\sprovided\salso\s(just\sthe\ssegfault\sis\snot\salways\sreproducible).\r\n\r\nTo\suse\sit\sin\smodules\sor\sextensions\seither\sinternal\sstructures\sof\stclIO.h\sare\sexpected,\sor\swe\smust\simplement\snew\sfunction\slike\s"Tcl_GetChannelInterp"\s(for\sthe\ssingle\sor\smain\sinterpreter\smode\sonly).
J login sebres
J mimetype text/x-fossil-wiki
J resolution Fixed
J status Pending
K 75d525d37c931812e9b00a80f6f43ac062598d54
U sebres
Z 89acf99b215566749446677f9796be34