Skip to content
Tcl Source Code History Of Ticket 7c187a377311556a
Login

History Of Ticket 7c187a377311556a

Artifacts Associated With Ticket 7c187a377311556a

  1. Ticket change [4f385cbc20] (rid 140950) by blange on 2014-12-16 12:11:55:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. 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
      
    5. foundin initialized to: "8.6.3.1"
    6. is_private initialized to: "0"
    7. login: "blange"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "a4bf72618810ca924d451acd6d075000844a1cbb"
    10. resolution initialized to: "None"
    11. severity initialized to: "Critical"
    12. status initialized to: "Open"
    13. submitter initialized to: "blange"
    14. subsystem initialized to: "25. Channel System"
    15. title initialized to:
      Abort: Reuse of ChannelBuffer!  when using sockets with fcopy or tls/ssl on Linux
      
    16. type initialized to: "Bug"
  2. Ticket change [019bfc92e3] (rid 140976) by dgp on 2014-12-18 16:22:40:

    1. icomment:
      
      Good test scripts!  Reproduced on current trunk.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  3. Ticket change [54569b1df1] (rid 140977) by dgp on 2014-12-18 17:36:16:

    1. assignee changed to: "dgp"
    2. 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);
      
    3. login: "dgp"
    4. mimetype: "text/plain"
  4. Ticket change [6803939fe3] (rid 140982) by dgp on 2014-12-18 18:07:25:

    1. closedate changed to: "2457010.25515301"
    2. closer changed to: "dgp"
    3. icomment:
      
      Test and fix committed for 8.6.4.
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"