Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f3ebee58c946c61f13805a67aa42ae7744957e4f
Ticket: 3611974fffffffffffffffffffffffffffffffff
InitSubsystems multiple thread issue
User & Date: jan.nijtmans on 2013-06-18 10:40:19
Changes

  1. assignee changed to: "aku"
  2. closer changed to: "nobody"
  3. comment changed to:
    The mutex arrangement in TclInitSubsystems() seems
    to suffer from a significant flaw.  Consider two threads,
    A and B, calling the routine concurrently.  Thread A gets
    the lock first, sets subsystemsInitialized to 1 and starts
    calling the set of subsystem initializing routines.
    
    Meanwhile thread B makes the initial test 
    (subsystemsInitialized == 0) and since thread A
    has already set it to 1, thread B jumps straight
    to the bottom of TIS() and calls TclInitNotifier().
    
    The trouble is when B calls TclInitNotifier(), we
    have no idea how much of Tcl library initialization
    is actually done.  We just know it got started.
    
  4. icomment:
    I think there is a much simpler solution, committed now to core-8-5-branch and trunk. The original code contains the comment: "Have to set this bit here to avoid deadlock with the routines below us that call into TclInitSubsystems.". That may have been true in the past, but currently none of the "routime below"'s call TclInitSubsystems(). This means that subsystemsInitialized can be set to 1 as final step, which fixes the whole thread issue.
    
    This means that branch "bug-3611974" is no longer necessary. Agreed?
    
  5. login: "jan.nijtmans"
  6. mimetype: "text/plain"
  7. resolution changed to: "Fixed"
  8. severity changed to: "Minor"
  9. status changed to: "Pending"