.
D 2000-10-26T01:06:25
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s2355\sBug\nVersion:\s8.1.1\nSubmitDate:\s'1999-07-16'\nLastModified:\s'1999-07-21'\nSeverity:\sSER\nStatus:\sReleased\nSubmitter:\stechsupp\nChangedBy:\sredman\nOS:\sWindows\s95\nMachine:\sX86\nFixedDate:\s'1999-07-21'\nFixedInVersion:\s1.3\nClosedDate:\s'2000-10-25'\n\n\nName:\nDon\sPorter\n\nComments:\nThis\sbug\sis\svisible\son\sboth\sWindows\s95\sand\sWindows\s98,\sbut\snot\son\n\s\s\s\sWindows\sNT.\n\nReproducibleScript:\nThree\sscript\sfiles\sfollow,\sserver.tcl,\sdata.tcl,\sctrl.tcl:\n\s\s\s\s\n\s\s\s\s#\sFILE:\sserver.tcl\n\s\s\s\s#\sComputation\sengine/server\sprogram\n\s\s\s\s########################################################################\n\s\s\s\s#\sUtility\sproc\sfor\sreading\sfrom\snon-blocking\ssocket\n\s\s\s\sproc\sReceive\s{datahdlr\sclosehdlr\ss}\s{\n\s\s\s\s\s\s\s\sif\s{[catch\s{gets\s$s\sline}\sreadCount]}\s{\n\s\s\s\s#\ssocket\serror\n\s\s\s\s$closehdlr\s$s\n\s\s\s\sclose\s$s\n\s\s\s\sreturn\n\s\s\s\s\s\s\s\s}\s\n\s\s\s\s\s\s\s\sif\s{$readCount\s<\s0}\s{\n\s\s\s\sif\s{[fblocked\s$s]}\s{\n\s\s\s\s\s\s\s\sreturn\n\s\s\s\s}\n\s\s\s\sif\s{[eof\s$s]}\s{\n\s\s\s\s\s\s\s\s$closehdlr\s$s\n\s\s\s\s\s\s\s\sclose\s$s\n\s\s\s\s\s\s\s\sreturn\n\s\s\s\s}\n\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\s$datahdlr\s$s\s$line\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\s########################################################################\n\s\s\s\s#\sServer\sfor\sData\sclients.\s\sSend\sout\siteration\scounts\sto\sthem.\n\s\s\s\s#\sDisplay\stheir\sreplies\sin\sTk\slabels.\n\s\s\s\s\n\s\s\s\sset\sdatasockets\s{}\n\s\s\s\s\n\s\s\s\sproc\sDataHdlr\s{s\sline}\s{\n\s\s\s\s\s\s\s\sset\s::msg($s)\s$line\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\sproc\sDataCloseHdlr\s{s}\s{\n\s\s\s\s\s\s\s\sset\sidx\s[lsearch\s-exact\s$::datasockets\s$s]\n\s\s\s\s\s\s\s\sset\s::datasockets\s[lreplace\s$::datasockets\s$idx\s$idx]\n\s\s\s\s\s\s\s\sdestroy\s.l$s\n\s\s\s\s\s\s\s\sunset\s::msg($s)\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\sproc\sDataChannel\s{s\sh\sp}\s{\n\s\s\s\s\s\s\s\sfconfigure\s$s\s-blocking\s0\s-buffering\sline\s-translation\s{auto\scrlf}\n\s\s\s\s\s\s\s\sputs\s$s\s"Connected\sto\sData"\n\s\s\s\s\s\s\s\slappend\s::datasockets\s$s\n\s\s\s\s\s\s\s\spack\s[label\s.l$s\s-textvariable\smsg($s)]\n\s\s\s\s\s\s\s\sfileevent\s$s\sreadable\s[list\sReceive\sDataHdlr\sDataCloseHdlr\s$s]\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\ssocket\s-server\sDataChannel\s7000\n\s\s\s\s\n\s\s\s\sproc\sStepReport\s{ct}\s{\n\s\s\s\s\s\s\s\sforeach\ss\s$::datasockets\s{\n\s\s\s\sputs\s$s\s$ct\n\s\s\s\s\s\s\s\s}\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\s########################################################################\n\s\s\s\s#\sIterative\scomputation\sengine.\s[Step]\sis\sone\siteration.\n\s\s\s\s#\s[ChangeState]\sstarts\sand\sstops\sthe\scomputation.\n\s\s\s\s\n\s\s\s\sset\safterId\s{}\n\s\s\s\sset\sstate\s0\n\s\s\s\s\n\s\s\s\sproc\sChangeState\s{f}\s{\n\s\s\s\s\s\s\s\sif\s{$::state\s==\s$f}\s{\n\s\s\s\sreturn\n\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\safter\scancel\s$::afterId\n\s\s\s\s\s\s\s\sif\s{$f}\s{\n\s\s\s\sset\s::afterId\s[after\sidle\sStep]\n\s\s\s\s\s\s\s\s}\selse\s{\n\s\s\s\sset\s::afterId\s{}\n\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\sset\s::state\s$f\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\sset\scount\s0\n\s\s\s\s\n\s\s\s\sproc\sStep\s{}\s{\n\s\s\s\s\s\s\s\safter\s1000;#\sSimulate\scomputation\n\s\s\s\s\s\s\s\sStepReport\s[incr\s::count]\n\s\s\s\s\s\s\s\sset\s::afterId\s[after\s1\s{set\s::afterId\s[after\sidle\sStep]}]\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\s########################################################################\n\s\s\s\s#\sServer\sfor\sControl\sclients.\s\sRecieve\s"start"\sand\s"stop"\scommands\sfrom\n\s\s\s\s#\sthem\sto\sstart\sand\sstop\sthe\scomputation\sengine.\n\s\s\s\s\n\s\s\s\sproc\sCtrlHdlr\s{s\sline}\s{\n\s\s\s\s\s\s\s\sswitch\s-exact\s$line\s{\n\s\s\s\sstart{ChangeState\s1}\n\s\s\s\sstop{ChangeState\s0}\n\s\s\s\sdefault{}\n\s\s\s\s\s\s\s\s}\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\sproc\sCtrlCloseHdlr\s{s}\s{}\n\s\s\s\s\n\s\s\s\sproc\sCtrlChannel\s{s\sh\sp}\s{\n\s\s\s\s\s\s\s\sfconfigure\s$s\s-blocking\s0\s-buffering\sline\s-translation\s{auto\scrlf}\n\s\s\s\s\s\s\s\sputs\s$s\s"Connected\sto\sControl"\n\s\s\s\s\s\s\s\sfileevent\s$s\sreadable\s[list\sReceive\sCtrlHdlr\sCtrlCloseHdlr\s$s]\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\ssocket\s-server\sCtrlChannel\s5000\n\s\s\s\s\n\s\s\s\spack\s[button\s.quit\s-text\sQuit\s-command\sexit]\n\s\s\s\s#\sEND\sFILE:\sserver.tcl\n\s\s\s\s\n\s\s\s\s#\sFILE:\sdata.tcl\n\s\s\s\s#\sData\sclient\sprogram\n\s\s\s\sset\ss\s[socket\slocalhost\s7000]\n\s\s\s\sfconfigure\s$s\s-blocking\s0\s-buffering\sline\s-translation\s{auto\scrlf}\n\s\s\s\sfileevent\s$s\sreadable\s[list\sRead\s$s]\n\s\s\s\sproc\sRead\s{s}\s{\n\s\s\s\s\s\s\s\sset\s::value\s[gets\s$s]\n\s\s\s\s\s\s\s\sif\s{![eof\s$s]}\s{\n\s\s\s\sputs\s$s\s"Got:\s$::value"\n\s\s\s\s\s\s\s\s}\n\s\s\s\s}\n\s\s\s\slabel\s.l\s-textvariable\svalue\n\s\s\s\sbutton\s.quit\s-text\sQuit\s-command\sexit\n\s\s\s\spack\s.l\s.quit\n\s\s\s\s#\sEND\sFILE:\sdata.tcl\n\s\s\s\s\n\s\s\s\s#\sFILE:\sctrl.tcl\n\s\s\s\s#\sControl\sclient\sprogram\n\s\s\s\sset\ss\s[socket\slocalhost\s5000]\n\s\s\s\sfconfigure\s$s\s-blocking\s0\s-buffering\sline\s-translation\s{auto\scrlf}\n\s\s\s\sbutton\s.start\s-text\sStart\s-command\s{puts\s$s\sstart}\n\s\s\s\sbutton\s.stop\s-text\sStop\s-command\s{puts\s$s\sstop}\n\s\s\s\sbutton\s.quit\s-text\sQuit\s-command\sexit\n\s\s\s\spack\s.start\s.stop\s.quit\n\s\s\s\s#\sEND\sFILE:\sctrl.tcl\n\nObservedBehavior:\nUsing\swish,\sstart\sone\scopy\seach\sof\sserver.tcl,\sctrl.tcl,\sand\sdata.tcl,\n\s\s\s\sin\sthat\sorder.\s\sClick\s"Start"\sand\s"Stop"\sin\sthe\sctrl\swindow\sto\ssee\show\n\s\s\s\sthe\scontrol\sclient\sstarts\sand\sstops\sthe\scomputation\sin\sthe\sserver.\s\sThe\n\s\s\s\siteration\scount\sdisplayed\sin\sthe\sdata\sclient\swill\sstart\sand\sstop\son\n\s\s\s\scommand.\n\s\s\s\sWhatever\siteration\scount\sis\sdisplayed\swhen\sthe\s"Stop"\sbutton\sis\sclicked,\n\s\s\s\sone\smore\siteration\swill\sdisplay,\sthen\sthe\sserver's\scomputation\swill\n\s\s\s\sstop,\n\s\s\s\sand\sthe\siteration\sdisplay\swill\sstop\schanging.\n\s\s\s\s\n\s\s\s\sNext,\sstart\smore\sdata\sclients.\s\sAfter\sonly\sa\sfew\s(I\ssee\sthe\sproblem\n\s\s\s\sreliably\n\s\s\s\swith\s4\sdata\sclients),\sthe\sserver\swill\sno\slonger\srespond\simmediately\sto\sa\n\s\s\s\s"Stop"\scommand\sfrom\sthe\scontrol\sclient.\s\sThe\siteration\sdisplay\swill\n\s\s\s\skeeping\n\s\s\s\sticking\smerrily\salong\sfor\smany\siterations\sbefore\sthe\s"Stop"\scommand\sis\n\s\s\s\sfinally\sacknowledged,\sand\sthe\scomputation\sand\siteration\sdisplay\sstop.\n\s\s\s\s\n\s\s\s\sThe\ssocket\smessage\swith\sthe\s"Stop"\scommand\sfrom\sthe\scontrol\sclient\sis\n\s\s\s\scrowded\n\s\s\s\sout\sby\sthe\ssea\sof\sreply\smessages\s"Got:\s$i"\sfrom\sthe\sdata\sclients.\s\sThe\n\s\s\s\ssocket\sreadable\sfileevent\scode\sin\sTcl\sis\snot\squeueing\sthe\sreadable\n\s\s\s\sfileevents\sfairly.\s\sThe\sfileevent\scarrying\sthe\s"Stop"\scommand\scan\sbe\n\s\s\s\sdelayed\sindefinitely\swhile\n\s\s\s\smore\srecently\sarrived\ssocket\sdata\sis\sread\sfrom\sthe\sdata\sclients.\n\nDesiredBehavior:\nWhen\smultiple\ssockets\shave\sreadable\sfileevent\shandlers,\straffic\son\sone\n\s\s\s\ssocket\sshould\snot\sbe\sstarved\sof\shandling\swhile\smore\srecent\straffic\son\n\s\s\s\sother\ssockets\sis\shandled.\s\s\n\s\s\s\s\n\s\s\s\sRun\sthe\ssame\stest\sscripts\susing\swish8.0p2.\s\sEverything\sworks\sas\sexpected\n\s\s\s\swith\sthat\sversion\sof\sTcl/Tk\son\sWindows\s95.\s\sThe\schanges\smade\sto\n\s\s\s\stclWinSock.c\n\s\s\s\sin\sthe\sTcl\s8.0.3\srelease\sapparently\sintroduced\sthis\sbug.\s\sThe\sbug\n\s\s\s\spersists\n\s\s\s\sin\sall\ssubsequent\sTcl/Tk\sreleases\sup\sthrough\s8.1.1.\n\n\n\nReproduced\swith\s8.1.1,\sbut\snow\sworks\sfine\swith\s8.2b2\scode.\n\n\s\n--\s07/21/1999\sredman
J foundin final:\s8.1.1
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 69.\sOther
J title socket\sfileevents\sdon't\squeue\sfairly
J type Bug
K 218840ffffffffffffffffffffffffffffffffff
U nobody
Z 6b71139e9ca86ef871c58c88245be712