Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 4236a9d811ad8623b1203149828d9b8a966d4aa3
Ticket: 898342ffffffffffffffffffffffffffffffffff
error from thread for code different from TCL_OK
User & Date: marcomaggi on 2004-02-16 22:16:19
Changes

  1. assignee changed to: "andreas_kupries"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    The following script crashes TCL 8.4.5 with Thread 2.5,
    and only
    makes Thread 2.5.2 output an error.
    
    package require Tcl 8.4
    package require Thread 2.5
    
    set thread [thread::create -joinable -preserved]
    thread::send -async $thread {
        break
    } result
    vwait result
    
    # we never reach this point.
    thread::release $thread
    thread::join $thread
    exit 0
    
    The problem is triggered by [break], [continue] and
    [return]: all
    the commands that return a value different from TCL_OK.
    
    When trying with Thread 2.5 the trace is:
    
    Program received signal SIGSEGV, Segmentation fault.
    ...
    #0  0x401e303f in strlen () from /lib/libc.so.6
    #1  0xbffff754 in ?? ()
    #2  0x400bbdb8 in Tcl_DbNewStringObj (
        bytes=0x61616161 <Address 0x61616161 out of
    bounds>, length=-1, 
        file=0x400e3bbf "./../generic/tclVar.c", line=1395)
        at ./../generic/tclStringObj.c:265
    #3  0x400c64a6 in Tcl_SetVar2 (interp=0x804ec90,
    part1=0x402f0ae7 "errorCode", 
        part2=0x0, newValue=0x61616161 <Address 0x61616161
    out of bounds>, flags=1)
        at ./../generic/tclVar.c:1395
    #4  0x400c6465 in Tcl_SetVar (interp=0x804ec90,
    varName=0x402f0ae7 "errorCode", 
        newValue=0x61616161 <Address 0x61616161 out of
    bounds>, flags=1)
        at ./../generic/tclVar.c:1342
    #5  0x402e5a4c in ThreadClbkSetVar (interp=0x804ec90,
    clientData=0x80897c8)
        at ../generic/threadCmd.c:1379
    #6  0x402e78eb in ThreadEventProc (evPtr=0x811d698,
    mask=-3)
        at ../generic/threadCmd.c:2626
    #7  0x400a90f1 in Tcl_ServiceEvent (flags=-3) at
    ./../generic/tclNotify.c:625
    #8  0x400a95a1 in Tcl_DoOneEvent (flags=-3) at
    ./../generic/tclNotify.c:930
    #9  0x4007134c in Tcl_VwaitObjCmd (clientData=0x0,
    interp=0x804ec90, objc=2, 
        objv=0xbffff234) at ./../generic/tclEvent.c:1041
    #10 0x4003e8f5 in TclEvalObjvInternal
    (interp=0x804ec90, objc=2, objv=0xbffff234, 
        command=0x8069929 "vwait result\n\nthread::release
    $thread\nthread::join $thread\n\nexit 0\n\n### end of
    file\n\n", length=13, flags=0)
        at ./../generic/tclBasic.c:3087
    #11 0x4003f644 in Tcl_EvalEx (interp=0x804ec90, 
        script=0x8069848 "package require Tcl 8.4\npackage
    require Thread 2.5\nset other 0\nif { $other } {\n   
    package require tcltest 2.2\n}\n\n\nset thread
    [thread::create -joinable]\n\nthread::send -async
    $thread {\n    set ans {}\n "..., numBytes=310, 
        flags=0) at ./../generic/tclBasic.c:3682
    #12 0x4009a5fc in Tcl_FSEvalFile (interp=0x804ec90,
    pathPtr=0x806e0e8)
        at ./../generic/tclIOUtil.c:1749
    #13 0x400a3c53 in Tcl_Main (argc=1, argv=0xbffff758, 
        appInitProc=0x80486c8 <Tcl_AppInit>) at
    ./../generic/tclMain.c:292
    #14 0x080486bc in main (argc=2, argv=0xbffff754) at
    ./../unix/tclAppInit.c:90
    
    tcl_platform(byteOrder) = littleEndian
    tcl_platform(machine)   = i686
    tcl_platform(os)        = Linux
    tcl_platform(osVersion) = 2.4.22
    tcl_platform(platform)  = unix
    tcl_platform(threaded)  = 1
    tcl_platform(user)      = marco
    tcl_platform(wordSize)  = 4
    
    I think that the problem is ThreadClbkSetVar()
    (threadCmd.c): it
    does the (TCL_OK != code) test while it should do
    (TCL_ERROR == code).
    
    
    
  4. foundin changed to: "None"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "marcomaggi"
  9. subsystem changed to: "49. Threading"
  10. title changed to: "error from thread for code different from TCL_OK"
  11. type changed to: "Bug"