Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: c868f5f04062c727b455f996833e033394863eb7
Ticket: 2001201fffffffffffffffffffffffffffffffff
Tcl_Exit() shouldn't call the full Tcl_Finalize() path
User & Date: georgeps on 2008-08-16 00:19:05
Changes

  1. icomment:
    Logged In: YES 
    user_id=585068
    Originator: YES
    
    Here is a simple Thread test case that faults before the patch is applied, due to the exit of the main thread causing the other threads to have invalid state during Tcl_Finalize, but before TclpExit.
    
    package require Thread
    
    set script {
      puts [time {
        set total 0 ; for {set i 0} {$i < 10000000} {incr i} {incr total $i} ; set total
      }]
    }
    
    
    set t1 [thread::create]
    set t2 [thread::create]
    
    thread::send -async $t1 $script
    thread::send -async $t2 $script
    
    ----
    $ tclsh8.6 tcl_thread_speed_test.tcl 
    Segmentation fault (core dumped)
    
    (gdb) bt
    #0  0xb7e99a04 in __pthread_mutex_unlock_usercnt ()
       from /lib/tls/i686/cmov/libpthread.so.0
    #1  0xb7f9b74f in Tcl_MutexUnlock () from /usr/local/lib/libtcl8.6.so
    #2  0xb7f9c55f in Tcl_WaitForEvent () from /usr/local/lib/libtcl8.6.so
    #3  0xb7f64726 in Tcl_DoOneEvent () from /usr/local/lib/libtcl8.6.so
    #4  0xb7485027 in ThreadWaitObjCmd ()
       from /usr/local/lib/thread2.6.5/libthread2.6.5.so
    #5  0xfffffffd in ?? ()
    #6  0xb7fbf324 in ?? () from /usr/local/lib/libtcl8.6.so
    #7  0xb7fc65ec in tclTomMathConstStubsPtr () from /usr/local/lib/libtcl8.6.so
    #8  0xb7f6f4c0 in ?? () from /usr/local/lib/libtcl8.6.so
    Cannot access memory at address 0xfca3bad3
    
    
    
  2. login: "georgeps"
  3. mimetype: "text/plain"
  4. username: "georgeps"