Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 897c711e113603f9f487b372d620f1005527a89a
Ticket: b47b176adf7c33681946162ba6a171281ff8381e
iortrans.tf-11.0 segfault
User & Date: dgp on 2014-06-19 16:31:27
Changes

  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"