Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 4f385cbc20e5ba495df8c85d224d621672454b3d
Ticket: 7c187a377311556abe067987cbd6a4009becf689
Abort: Reuse of ChannelBuffer! when using sockets with fcopy or tls/ssl on Linux
User & Date: blange on 2014-12-16 12:11:55
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed 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
    
  5. foundin changed to: "8.6.3.1"
  6. is_private changed to: "0"
  7. login: "blange"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "a4bf72618810ca924d451acd6d075000844a1cbb"
  10. resolution changed to: "None"
  11. severity changed to: "Critical"
  12. status changed to: "Open"
  13. submitter changed to: "blange"
  14. subsystem changed to: "25. Channel System"
  15. title changed to:
    Abort: Reuse of ChannelBuffer!  when using sockets with fcopy or tls/ssl on Linux
    
  16. type changed to: "Bug"