<i>Socket -server stops accepting connections under load</i> status still Open with 4 other changes
by
.
D 2010-09-23T05:31:21
J icomment Hi,\n\n>\sCan\syou\sprovide\sus\swith\sa\sunified\sdiff\sfor\sthe\spatch\s?\sOr\scontext\sdiff.\nWill\sdo\sso\stomorrow,\sI\sdon't\shave\sthe\scodebase\son\sthis\sPC.\n>\sAnything\swhich\stells\sme\snot\sjust\sthe\sline\snumbers,\sbut\salso\sshows\sthe\n>\srelevant\scode\sand\sthings\saround\sit.\sUsing\sthe\sline\snumber\swith\sTcl\sHead\sit\n>\sseems\sthat\syou\sare\sputting\sthe\slocks\saround\sthe\sstatement\n>\n>\s\s\s\s\s"infoPtr->acceptEventCount--;"\n\nSounds\sabout\sright.\n\n>\sExcept\sthat\sthere\sare\sother\sstatements\salso\smodifying/querying\n>\sacceptEventCount\sand\spossinbly\sshould\sbe\slocked\sas\swell.\n\nYes.\s\sI\sseem\sto\srecall\schecking\sthat\sthe\sother\smodifications\swere\ssafe.\s\sBut\sI\salso\srecall\sadding\sinfo\sabout\sthis\sto\sthe\sbug\sreport,\swhich\sI\sclearly\sdidn't\sdo\s:(\s\sI\sguess\sI'll\slook\sagain.\n\n>\sAnother\sissue\sI\shave\sis\sthat\sit\sis\sextremely\sunclear\show\sthis\sstructure\sis\n>\smodified\sby\smultiple\sthreads.\sThis\smay\sbe\smy\sown\snon-knowledge\sof\sthe\n>\s(windows)\snotifier,\sso\sI\shope\syou\scan\senlighten\sme.\n\nThe\strick,\sif\sI\sunderstand\sit,\sis\sthat\seach\sthread\shas\sa\ssocketList\sin\sthread-specific-data\s(tsdPtr),\sand\salso\sa\s"co-thread"\s(tsdPtr->socketThread)\sto\sreceive\sWSAAsyncSelect()\sevents\sinto\sSocketProc().\n\nSocketProc()\scalls\sTcl_ThreadAlert()\sto\squeue\sthe\sevents\sthat\swill\sbe\shandled\sby\sSocketEventProc().\n\nThe\stsdPtr->socketListLock\sis\sused\sto\sprevent\srace\sconditions\sbetween\sthe\sinterp\sthread\sand\s"co-thread"\swhile\saccessing\stsdPtr.\n\n>\sFirst,\sthe\ssocket\sshould\sbe\sowned\sby\sa\ssingle\sthread\sand\sno\sother\sshould\n>\saccess\sit.\n\nThe\ssocket\sis\saccessed\sby\sthe\sco-thread.\s\stsdPtr\sis\sused\sto\scommunicate\sbetween\sthe\sinterp\sthread\sand\sthe\sco-thread.\s\sThis\sis\sa\srace\scondition\sbetween\sthose\sthreads.\n\nOne\sexample\sof\sthe\srace\scondition\sis\swhen\sthere\sis\sa\scontext\sswitch\simmediately\safter\schecking\sthe\sacceptEventCount\sin\sTcpAccept():\n\s\sThread1\s(TcpAccept)\s:\sinfoPtr->acceptEventcount--;\n\s\sThread1\s(TcpAccept)\s:\sif\s(infoPtr->acceptEventCount\s<=\s0)\s{\n\s\s**\scontext\sswitch\s**\n\s\sThread2\s(SocketProc)\s:\sinfoPtr->readEvents\s|=\sevent;\n\s\sThread2\s(SocketProc)\s:\s...\n\s\s**\scontext\sswitch\s**\n\s\sThread1\s(TcpAccept)\s:\s\s\sinfoPtr->readEvents\s&=\s~(FD_ACCEPT);\n\n\n
J login twylite
J mimetype text/plain
J username twylite
K 3056775fffffffffffffffffffffffffffffffff
U twylite
Z 275e35628b04d96204c9cba95730aff2