Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 4482b9897458baa2a0f7be5792a7e6bbd0466bc1
Ticket: 2536400fffffffffffffffffffffffffffffffff
zlib in a client TCP stack SIGSEGVs on socket shutdown
User & Date: flatworm on 2009-01-26 00:35:45
Changes

  1. assignee changed to: "dkf"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    If zlib is bumped into a client TCP channel in "compress" mode with -buffering none and -flush sync channel options, zlib code seems to crash Tcl on unexpected remote socket shutdowns, when the interpreter receives the SIGPIPE error from the socket subsystem.
    
    Without zlib enabled, a "TCP client" script (expectedly) errors out with the "broken pipe" error, with zlib it SIGSEGVs whth this backtrace:
    
    Program received signal SIGSEGV, Segmentation fault.
    0xb7ea0f11 in Tcl_GetObjResult (interp=0x0)
        at /home/kostix/devel/tcl/generic/tclResult.c:570
    570         if (*(iPtr->result) != 0) {
    (gdb) bt
    #0  0xb7ea0f11 in Tcl_GetObjResult (interp=0x0)
        at /home/kostix/devel/tcl/generic/tclResult.c:570
    #1  0xb7ea1030 in Tcl_AppendResultVA (interp=0x0, 
        argList=0xbf81fa74 "��035>�)
        at /home/kostix/devel/tcl/generic/tclResult.c:617
    #2  0xb7ea109f in Tcl_AppendResult (interp=0x0)
        at /home/kostix/devel/tcl/generic/tclResult.c:671
    #3  0xb7ec242f in ChanClose (instanceData=0x9527418, interp=0x0)
        at /home/kostix/devel/tcl/generic/tclZlib.c:2239
    #4  0xb7e5f3b4 in ChanClose (chanPtr=0x952b468, interp=0x0)
        at /home/kostix/devel/tcl/generic/tclIO.c:257
    #5  0xb7e5f350 in TclFinalizeIOSubsystem ()
        at /home/kostix/devel/tcl/generic/tclIO.c:465
    #6  0xb7e3b608 in Tcl_FinalizeThread ()
        at /home/kostix/devel/tcl/generic/tclEvent.c:1141
    #7  0xb7e3b518 in Tcl_Finalize ()
        at /home/kostix/devel/tcl/generic/tclEvent.c:977
    #8  0xb7e3b3e9 in Tcl_Exit (status=1)
        at /home/kostix/devel/tcl/generic/tclEvent.c:828
    #9  0xb7deec31 in Tcl_ExitObjCmd (dummy=0x0, interp=0x95028e0, objc=2, 
        objv=0x950304c) at /home/kostix/devel/tcl/generic/tclCmdAH.c:789
    #10 0xb7de037f in NRRunObjProc (data=0x9519374, interp=0x95028e0, result=0)
        at /home/kostix/devel/tcl/generic/tclBasic.c:4302
    #11 0xb7de0110 in TclNRRunCallbacks (interp=0x95028e0, result=0, 
        rootPtr=0x9518f68, tebcCall=1)
        at /home/kostix/devel/tcl/generic/tclBasic.c:4240
    #12 0xb7e3fd5f in TclExecuteByteCode (interp=0x95028e0, codePtr=0x952c688)
        at /home/kostix/devel/tcl/generic/tclExecute.c:2814
    #13 0xb7de041e in NRCallTEBC (data=0x951956c, interp=0x95028e0, result=0)
        at /home/kostix/devel/tcl/generic/tclBasic.c:4324
    #14 0xb7de0110 in TclNRRunCallbacks (interp=0x95028e0, result=0, rootPtr=0x0, 
        tebcCall=0) at /home/kostix/devel/tcl/generic/tclBasic.c:4240
    #15 0xb7de22c6 in TclEvalObjEx (interp=0x95028e0, objPtr=0x0, flags=131072, 
        invoker=0x0, word=0) at /home/kostix/devel/tcl/generic/tclBasic.c:5716
    #16 0xb7de224d in Tcl_EvalObjEx (interp=0x95028e0, objPtr=0x0, flags=131072)
        at /home/kostix/devel/tcl/generic/tclBasic.c:5697
    #17 0xb7e7f021 in Tcl_Main (argc=-1, argv=0xbf820b70, 
        appInitProc=0x80486eb <Tcl_AppInit>)
        at /home/kostix/devel/tcl/generic/tclMain.c:579
    #18 0x080486dc in main (argc=1404316, argv=0xb7d9d548)
        at /home/kostix/devel/tcl/unix/tclAppInit.c:87
    
    I have attached the sample script that can be used to reproduce the crash.
    One instance of it should be run as a server, like
    $ tclsh8.6 zchanstack.tcl server
    and the second on as a client, like
    $ tclsh8.6 zchanstack.tcl client
    The server code immediately closes the socket forcing the client to crash.
    
  4. foundin changed to: "obsolete: 8.6b1.1"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "flatworm"
  10. subsystem changed to: "57. zlib"
  11. title changed to:
    zlib in a client TCP stack SIGSEGVs on socket shutdown
    
  12. type changed to: "Bug"