Skip to content
Tcl Source Code Artifact [800a490fba]
Login

Artifact [800a490fba]

Artifact 800a490fba0d615836dbc90f5933c6d2bf55aed1:

Ticket change [800a490fba] - New ticket [599468ffffffffff|599468ffff] <i>fcopy leaks channels</i>. by davidw on 2002-08-24 00:01:30.
D 2002-08-24T00:01:30
J assignee andreas_kupries
J cmimetype text/plain
J comment This\smay\sbe\smore\sthan\sone\sproblem.\s\sFor\snow,\sI\sam\nfiling\sit\sall\shere.\n\nFirst,\sthe\scode:\n\nServer\n----\nproc\sbgerror\s{args}\s{\n\s\s\s\sputs\s"bgerror\sargs:\s$args"\n\s\s\s\sputs\s"bgerror\sopen\schannels\s[file\schannels]"\n}\n\nproc\sCopyDone\s{in\sout\sbytes\s{error\s""}}\s{\n\s\s\s\sif\s{\s$error\s!=\s""\s}\s{\nputs\s"Error:\s$error"\n\s\s\s\s}\n\s\s\s\sclose\s$in\n\s\s\s\sclose\s$out\n\s\s\s\sputs\s"$bytes\sbytes,\sopen\schannels\s[file\schannels]"\n}\n\nproc\sCntr\s{sock\sargs}\s{\n\s\s\s\sset\sfl\s[open\sA_BIG_FILE\s\sr]\n#\s\s\s\sclose\s$sock\n#\s\s\s\sfconfigure\s$sock\s-buffersize\s10\n\s\s\s\sfcopy\s$fl\s$sock\s-command\s[list\sCopyDone\s$fl\s$sock]\n}\n\nsocket\s-server\sCntr\s8070\n\nvwait\sforever\n----\n\n"Client"\n----\n\nset\ssk\s[socket\slocalhost\s8070]\nfconfigure\s$sk\s-buffersize\s10\nset\sline\s[read\s$sk\s5]\nputs\s$line\nclose\s$sk\n----\n\nIt's\sworth\strying\sother\smethods\sof\sinterrupting\ncomunication\swith\sthe\sserver.\s\sPrograms\ssuch\sas\stelnet\nand\snetcat\swork\sfor\sthis.\n\nThe\sProblem(s)\n============\n\nThe\seasiest\sproblem\sto\sobserve\scan\sbe\sobserved\sunder\nLinux.\s\sUncomment\sthe\s'close\s$sock'\sline\sin\sthe\sserver,\nand\sconnect\sto\sthe\sserver\swith\sthe\s'client'.\s\sI\ssee\nsomething\slike\sthis,\son\smultiple\sconnects:\n\n@ashland\s[~/tmp]\s$\sstrace\s-o\sfoobar\stclsh\s./fcopy.tcl\nbgerror\sargs:\s{can\snot\sfind\schannel\snamed\s"sock4"}\nbgerror\sopen\schannels\sstdin\sfile5\sstdout\sstderr\ssock3\nbgerror\sargs:\s{can\snot\sfind\schannel\snamed\s"sock4"}\nbgerror\sopen\schannels\sstdin\sfile5\sstdout\sfile6\sstderr\ssock3\nbgerror\sargs:\s{can\snot\sfind\schannel\snamed\s"sock4"}\nbgerror\sopen\schannels\sstdin\sfile5\sstdout\sfile6\sstderr\nfile7\ssock3\nbgerror\sargs:\s{can\snot\sfind\schannel\snamed\s"sock4"}\nbgerror\sopen\schannels\sfile8\sstdin\sfile5\sstdout\sfile6\nstderr\sfile7\ssock3\nbgerror\sargs:\s{can\snot\sfind\schannel\snamed\s"sock4"}\nbgerror\sopen\schannels\sfile8\sstdin\sfile9\sfile5\sstdout\nfile6\sstderr\sfile7\ssock3\nbgerror\sargs:\s{can\snot\sfind\schannel\snamed\s"sock4"}\nbgerror\sopen\schannels\sfile8\sstdin\sfile10\sfile9\sfile5\nstdout\sfile6\sstderr\sfile7\ssock3\n\nThe\sstrace\sshows\sthat\sthe\sfd's\sare\snot\sgetting\sclosed.\n\n#2\n==\n\nOn\swindows\s(XP\sin\smy\scase),\scomment\sout\sthe\sclose\nstatement\sin\sthe\sserver,\sand\srun\sthe\s'client'\smultiple\ntimes.\s\sIn\ssome\scases,\sit\scalls\sthe\scallback\swith\san\nerror,\sbut\sother\stimes\sit\sdoes\snot.\s\sOver\stime,\sit\scan\nbe\sseen\sthat\sthe\schannels\sare\sleaking.\n\nComments\n========\n\nI\sdon't\sknow\swhat\sthe\scorrect\sbehavior\sshould\sbe\sin\sall\ncases.\s\sThe\sman\spage\sdoes\ssay\sthat:\s\n\n\s\s\s\s\s\s\sYou\sare\snot\sallowed\sto\sdo\sother\sI/O\soperations\nwith\sinchan\n\s\s\s\s\s\s\sor\soutchan\sduring\sa\sbackground\sfcopy.\s\sIf\seither\ninchan\sor\n\s\s\s\s\s\s\soutchan\sget\sclosed\swhile\sthe\scopy\sis\sin\nprogress,\sthe\scurĀ­\n\s\s\s\s\s\s\srent\scopy\sis\sstopped\sand\sthe\scommand\scallback\sis\nnot\smade.\n\s\s\s\s\s\s\sIf\s\sinchan\s\sis\s\sclosed,\s\sthen\s\sall\sdata\salready\nqueued\sfor\n\s\s\s\s\s\s\soutchan\sis\swritten\sout.\n\nIt\sdoesn't\sspecify\swhat\shappens\sother\sthan\sthat,\nthough.\s\sI\ssuppose\swe\scould\sjust\sdeclare\sthat\s'bad\nthings\shappen',\sand\sleave\sit\sat\sthat,\sbut\sthat\sdoesn't\nfeel\svery\ssatisfactory\sto\sme.\s\sI\sexpect\sTcl\sto\sbe\smore\nrobust\sthan\sthat.\n\n
J foundin None
J priority 5\sMedium
J resolution None
J status Open
J submitter davidw
J subsystem 24.\sChannel\sCommands
J title fcopy\sleaks\schannels
J type Bug
K 599468ffffffffffffffffffffffffffffffffff
U davidw
Z 562bc7457e3cd823cd779cc1c053415b