Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 7dde2fc044c8bbcde2a72550a527c75e1568fea190b0d453501c357a7b32f86d
Ticket: 815e2468064b4324bc4b303b9bafd3ef92803c32
tcl crash on channel thread transfer and fileevent writable in place
User & Date: sebres on 2018-06-08 22:51:59
Changes

  1. icomment:
    The case if channel switches owner via "thread::transfer" fixed now in [2e7300065a].
    
    Currently still as interim state, because thread::detach/attach still failed sporadically with "SIGBUS":
    <pre style="padding-left:10pt"><code>
    Thread 2 "tclsh" received signal SIGBUS, Bus error.
    [Switching to Thread 0x7ffff62bc700 (LWP 20721)]
    0x00007ffff7b089c3 in TclChannelEventScriptInvoker () from ./libtcl8.6.so
    
    #0  0x00007ffff7b089c3 in TclChannelEventScriptInvoker () from ./libtcl8.6.so
    #1  0x00007ffff7b0da0f in Tcl_NotifyChannel () from ./libtcl8.6.so
    #2  0x00007ffff7b69a77 in FileHandlerEventProc () from ./libtcl8.6.so
    #3  0x00007ffff7b280cf in Tcl_ServiceEvent () from ./libtcl8.6.so
    #4  0x00007ffff7b283f4 in Tcl_DoOneEvent () from ./libtcl8.6.so
    #5  0x00007ffff62c05df in ThreadWaitObjCmd () from ./libthread2.9a1.so
    #6  0x00007ffff7a61827 in TclNRRunCallbacks () from ./libtcl8.6.so
    #7  0x00007ffff7a63932 in TclEvalEx () from ./libtcl8.6.so
    #8  0x00007ffff7a63ee3 in Tcl_EvalEx () from ./libtcl8.6.so
    #9  0x00007ffff62c2502 in NewThread () from ./libthread2.9a1.so
    #10 0x00007ffff70236ca in start_thread (arg=0x7ffff62bc700) at pthread_create.c:333
    #11 0x00007ffff77600af in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:105
    
    Stack level 0, frame at 0x7ffff62bbc60:
     rip = 0x7ffff7b089c3 in TclChannelEventScriptInvoker; saved rip = 0x7ffff7b0da0f
     called by frame at 0x7ffff62bbcb0
     Arglist at 0x7ffff62bbc18, args:
     Locals at 0x7ffff62bbc18, Previous frame's sp is 0x7ffff62bbc60
     Saved registers:
      rbx at 0x7ffff62bbc38, rbp at 0x7ffff62bbc40, r12 at 0x7ffff62bbc48, r13 at 0x7ffff62bbc50, rip at 0x7ffff62bbc58
    </code></pre>
    The reason is the case of synchronous sending of the attach inside of the running event-handler is more complex as provided solution.
    
    But strange is trying to simulate thread::transfer, using "send -async" by attach, ends into SIGSEGV with almost the same call-stack inside TclChannelEventScriptInvoker.
    
    I doubt it may be something wrong with "detach", because it does definitelly the owner thread.
    
    WiP
    
  2. login: "sebres"
  3. mimetype: "text/x-fossil-wiki"