From: SourceForge.net <no...@so...> - 2009-11-10 23:45:14
|
Bugs item #2895565, was opened at 2009-11-10 15:02 Message generated for change (Comment added) made by andreas_kupries You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=2895565&group_id=10894 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 02. Event Loops Group: current: 8.5.7 Status: Open Resolution: None Priority: 9 Private: No Submitted By: Alexandre Ferrieux (ferrieux) Assigned to: Alexandre Ferrieux (ferrieux) Summary: Busyloop in vwait in innocent HTTP code Initial Comment: As reported in http://groups.google.com/group/comp.lang.tcl/tree/browse_frm/thread/6deca54954e61cfd/94ab3376153994d0?rnum=1&_done=%2Fgroup%2Fcomp.lang.tcl%2Fbrowse_frm%2Fthread%2F6deca54954e61cfd%2F432b7b5576b7ec5c%3F#doc_19398a625d24ac4d In 8.5 HEAD: set file_id [open myfile.html w] http::geturl http://www.yahoo.com -channel $file_id \ -blocksize 4096 -timeout 60000 close $file_id This code, in addition to only downloading an incomplete file, busyloops during the whole timeout. It seems the 0-millisecond timer at line 7978 of TclIO.c fires repeatedly. ---------------------------------------------------------------------- >Comment By: Andreas Kupries (andreas_kupries) Date: 2009-11-10 15:45 Message: Why is DoWriteChars() returning a number which is larger than the size of the buffer it got ? ---------------------------------------------------------------------- Comment By: Alexandre Ferrieux (ferrieux) Date: 2009-11-10 15:34 Message: In TclIO.c +8710: I see that in the binary->non-binary case, we correctly call DoWriteChars, but we then use the returned number of bytes (which is 4165 here for an initial 4096 buffer). Then when we decrement the total count to read by this value, we get a negative result: if (outBinary || sameEncoding) { sizeb = DoWrite(outStatePtr->topChanPtr, buffer, sizeb); } else { sizeb = DoWriteChars(outStatePtr->topChanPtr, buffer, sizeb); } if (inBinary || sameEncoding) { /* * Both read and write counted bytes. */ size = sizeb; ---------------------------------------------------------------------- Comment By: Alexandre Ferrieux (ferrieux) Date: 2009-11-10 15:21 Message: Turns out the tight loop involves CopyData, the worker from [fcopy]. Once established, it is entered with csPtr->toRead == -4 ! ---------------------------------------------------------------------- Comment By: Pat Thoyts (patthoyts) Date: 2009-11-10 15:21 Message: I can confirm this on 8.5 branch. It important that the channel not be binary. When I used [open output wb] the download succeeded. Adding -timeout and -command options do not affect the fault but do allow the job to be timedout which should help in testing. ie: http::geturl $url -channel $f -timeout 10000 -command [list close $f] ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=2895565&group_id=10894 |