Skip to content
Tcl Source Code History Of Ticket b47b176adf7c3368
Login

History Of Ticket b47b176adf7c3368

Artifacts Associated With Ticket b47b176adf7c3368

  1. Ticket change [e2977edcf0] (rid 138466) by dgp on 2014-06-18 13:06:53:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      Not every time, but if the test iortrans.tf-11.0
      is forced to run again and again, eventually it
      will fail with a segfault:
      
      ---- iortrans.tf-11.0 start
      
      Program received signal SIGSEGV, Segmentation fault.
      [Switching to Thread 0x2aaaae910940 (LWP 24638)]
      0x0000000000542697 in DeleteThreadReflectedTransformMap (clientData=0x0)
          at /home/dgp/fossil/tcl/generic/tclIORTrans.c:2353
      2353            paramPtr = evPtr->param;
      (gdb) print evPtr
      $1 = (ForwardingEvent *) 0x0
      
    5. foundin initialized to: "trunk"
    6. is_private initialized to: "0"
    7. login: "dgp"
    8. priority initialized to: "5 Medium"
    9. resolution initialized to: "None"
    10. severity initialized to: "Minor"
    11. status initialized to: "Open"
    12. submitter initialized to: "dgp"
    13. subsystem initialized to: "26. Channel Transforms"
    14. title initialized to: "iortrans.tf-11.0 segfault"
    15. type initialized to: "Bug"
  2. Ticket change [a583aa8a9e] (rid 138467) by dgp on 2014-06-18 14:11:39:

    1. assignee changed to: "aku"
    2. icomment:
      (gdb) bt
      #0  0x0000000000542697 in DeleteThreadReflectedTransformMap (clientData=0x0)
          at /home/dgp/fossil/tcl/generic/tclIORTrans.c:2353
      #1  0x00000000004ffbcf in Tcl_FinalizeThread ()
          at /home/dgp/fossil/tcl/generic/tclEvent.c:1294
      #2  0x000000000057fb58 in Tcl_ExitThread (status=0)
          at /home/dgp/fossil/tcl/generic/tclThread.c:470
      #3  0x00000000004fff9e in NewThreadProc (clientData=0xa44df0)
          at /home/dgp/fossil/tcl/generic/tclEvent.c:1559
      #4  0x0000003ddb00683d in start_thread () from /lib64/libpthread.so.0
      #5  0x0000003dda4d526d in clone () from /lib64/libc.so.6
      
      Passing to aku, in hopes he understands the management
      of the "forwardList" so I don't have to digest it.
      
    3. login: "dgp"
    4. mimetype: "text/plain"
    5. severity changed to: "Severe"
  3. Ticket change [be269c7503] (rid 138468) by aku on 2014-06-18 19:55:33:

    1. icomment:
      A quick note, the forwarding code in IORTrans should be identical to the forwarding code in tclIORChan. Bugs in one are likely in the other as well.
      
    2. login: "aku"
    3. mimetype: "text/plain"
  4. Add attachment "rtrans-forwarding.txt" [26bdbd924f] (rid 138470) by aku on 2014-06-18 20:38:43.

  5. Ticket change [9502f0254f] (rid 138472) by dgp on 2014-06-19 15:44:31:

    1. icomment:
      In the segfaulting run, the Tcl_ConditionWait() call
      doesn't return.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  6. Ticket change [897c711e11] (rid 138473) by dgp on 2014-06-19 16:31:27:

    1. icomment:
      It appears that the code is written making the
      assumption that when ConditionNotify is called
      and the the mutex is unlocked, that the next
      thing that will lock the mutex is the ConditionWait.
      That doesn't have to be true.
      
      In the failing case, ForwardOpToOwnerThread() in
      thread 1 placed a ForwardingResult on the forwardList
      and then waited in a ConditionWait.
      
      Then in thread 2 a [thread::exit] happens, which 
      first leads to a call to DeleteReflectedTransformMap()
      when an interp in thread 2 is being torn down.  This
      calls ForwardSetStaticError() and then ConditionNotify()
      and unlocks the mutex.
      
      If at this point, as often happens, thread 1 were to wake
      up and take over, it would pull the now-dead ForwardingResult
      off the forwardList, and all would be well....
      
      ....however, it can and sometimes does happen, that the
      next lock on the mutex will be acquired by thread 2 as
      it continues tearing down the thread, and now is in the
      call of DeleteThreadReflectedTransformMap().  The ForwardingResult
      is still on the forwardList, but now has resultPtr->evPtr == NULL,
      which leads to the crash.
      
      What must change is that no code processing the items on the
      forwardList can assume that just because a resultPtr is on the
      list, it must have a non-NULL resultPtr->evPtr.   Fortunately
      that's an easy fix.  Just check for NULL and continue when it is
      seen.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  7. Ticket change [f4df7f63bf] (rid 138476) by dgp on 2014-06-19 16:39:10:

    1. assignee changed to: "dgp"
    2. closedate changed to: "2456828.19386812"
    3. closer changed to: "dgp"
    4. icomment: "fixed on trunk."
    5. login: "dgp"
    6. mimetype: "text/plain"
    7. resolution changed to: "Fixed"
    8. status changed to: "Closed"
  8. Ticket change [7da6d08250] (rid 138478) by aku on 2014-06-19 16:54:32:

    1. closedate changed to: "2456828.20454615"
    2. closer changed to: "aku"
    3. icomment:
      Thank you for the analysis and fix.
      
      I will think on a suitable comment to add to the code to point out this variability (i.e. that DeleteReflectedTransformMap() may be followed by DeleteThreadReflectedTransformMap() instead of the originator thread handling it.
      
      Will see if I can take the time to fix the same issue in tclIORChan.c (8.5 first, then trunk).
      
    4. login: "aku"
    5. mimetype: "text/plain"