Artifacts Associated With Ticket 7c187a377311556a
Ticket change [4f385cbc20] (rid 140950) by blange on 2014-12-16 12:11:55:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
While trying to switch our apps to 8.6, we get crashes using sockets with fcopy or TSL/SSL. The code used is running unmodified since 8.4, but (sometimes/often) aborts on 8.6. It is not easy to reproduce - it only happens if client and server are on separate hosts and then only in 1 out of 5/10/400 times, as it seems to depend on network latency/buffering .. If the fcopy in the client example is replaced by an the read everything works as expected. But we are also seeing the same abort when doing https requests ... The loop in the client should not the problem, as we also tested this with the loop in a surrounding shell script. Normally the server part is a C-program, but we did one in tcl for the demonstration which serves the same purpose. We use an executable currently built from ActiveTcl 8.6.3.1.298624 which runs the client-script below. Current platforms used are SLES11-SP3 and openSuse 13.1. We also tried to reproduce the error with a windows client, but the error does not occur. (I presume due to the different I/O subsystems) If you need any more info .... please call :-) Benno ----------server part ------------------------------------- puts stderr "TCL $::tcl_patchLevel" # # bug server # set hport 6666 set ::dumlen 65532 set ::dumdat [string repeat {*} $::dumlen] proc gen_ans { ch }\ { # answer it set nfiles 3 puts $ch "$nfiles|xxxxxxxxxx" for { set nf 0 } { $nf < $nfiles } { incr nf }\ { fconfigure ${ch} -translation crlf -buffering line # send header info set lhdr [list [string length $::dumdat] "testadadadada.dat" S {}] puts $ch [join $lhdr {|}] fconfigure ${ch} -translation binary -buffering none puts -nonewline $ch $::dumdat } } proc do_bugserv { ch adr port } \ { fconfigure $ch -blocking true fconfigure $ch -buffering line # read initial request set rq [gets $ch] # answer it gen_ans $ch close $ch } set sck [socket -server do_bugserv $hport] vwait ::done ----------client part ------------------------------------- puts stderr "TCL $::tcl_patchLevel" set svr <<server-host>> set hport 6666 for {set n 0} { 1 } {incr n} \ { puts stderr "RUN #$n" set sock [socket ${svr} ${hport}] if { "$sock" == "" } \ { puts stderr "conn failed !!" exit -1 } fconfigure ${sock} -translation auto -buffering line # send intial request puts ${sock} "xxxxxxx|yy" # get initial response from server set resp [gets ${sock}] # 1. - # of files # 2. - unused puts stderr "resp=<[string length ${resp}]><${resp}>" lassign [split ${resp} {|}] nfiles dum if { ${nfiles} > 0 } \ { for { set fi 0 } { ${fi} < ${nfiles} } { incr fi } \ { # get file-response from server set resp [gets ${sock}] lassign [split ${resp} {|}] fsize fname - - puts stderr "receiving <$fname> - <$fsize>" if { ${fsize} > 0 } \ { fconfigure ${sock} -translation binary -buffering none set tfile {tmp.rcv} set ef [open ${tfile} {w+}] fconfigure ${ef} -translation binary set rc [fcopy ${sock} ${ef} -size ${fsize}] #-OK-- set rc [read ${sock} ${fsize}] close ${ef} fconfigure ${sock} -translation auto -buffering line } \ else \ { puts stderr "size error on <${fname}> !!" exit -1 } } } \ else \ { puts stderr "load info error !!" exit 1 } close ${sock} } puts stderr "DONE ok." exit 0 - foundin initialized to: "8.6.3.1"
- is_private initialized to: "0"
- login: "blange"
- priority initialized to: "5 Medium"
- private_contact initialized to: "a4bf72618810ca924d451acd6d075000844a1cbb"
- resolution initialized to: "None"
- severity initialized to: "Critical"
- status initialized to: "Open"
- submitter initialized to: "blange"
- subsystem initialized to: "25. Channel System"
- title initialized to:
Abort: Reuse of ChannelBuffer! when using sockets with fcopy or tls/ssl on Linux
- type initialized to: "Bug"
Ticket change [019bfc92e3] (rid 140976) by dgp on 2014-12-18 16:22:40:
- icomment:
Good test scripts! Reproduced on current trunk.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [54569b1df1] (rid 140977) by dgp on 2014-12-18 17:36:16:
- assignee changed to: "dgp"
- icomment:
This is the fix. Will commit once I've added a test case. Index: generic/tclIO.c ================================================================== --- generic/tclIO.c +++ generic/tclIO.c @@ -9213,10 +9213,13 @@ } else { outStatePtr->outQueueHead = inStatePtr->inQueueHead; } outStatePtr->outQueueTail = tail; inStatePtr->inQueueHead = bufPtr; + if (inStatePtr->inQueueTail == tail) { + inStatePtr->inQueueTail = bufPtr; + } if (bufPtr == NULL) { inStatePtr->inQueueTail = NULL; } code = FlushChannel(csPtr->interp, outStatePtr->topChanPtr, 0); - login: "dgp"
- mimetype: "text/plain"
Ticket change [6803939fe3] (rid 140982) by dgp on 2014-12-18 18:07:25:
- closedate changed to: "2457010.25515301"
- closer changed to: "dgp"
- icomment:
Test and fix committed for 8.6.4.
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"