Skip to content
Tcl Source Code History Of Ticket be38540b321769e5
Login

History Of Ticket be38540b321769e5

Artifacts Associated With Ticket be38540b321769e5

  1. Ticket change [1f17a6350d] (rid 185623) by christian.nassau on 2020-08-18 09:40:15:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      We are seeing the following stack trace for a child process started via fork; it seems to be permanently stuck in the call to "Tcl_MutexLock(allocMutexPtr);" (implicitly triggered by TCL_TSD_INIT(&dataKey) when there is not yet thread specific data for the dataKey):
      
      #0 0x00007f2c4e21a54d in __lll_lock_wait () from /lib64/libpthread.so.0
      #1 0x00007f2c4e215e9b in _L_lock_883 () from /lib64/libpthread.so.0
      #2 0x00007f2c4e215d68 in pthread_mutex_lock () from /lib64/libpthread.so.0
      #3 0x00007f2c49c59efc in TclpAlloc () from libtcl8.6.so
      #4 0x00007f2c49b83088 in Tcl_Alloc () from libtcl8.6.so
      #5 0x00007f2c49c59738 in Tcl_GetThreadData () from libtcl8.6.so
      #6 0x00007f2c49c7a12c in AtForkChild () from libtcl8.6.so
      #7 0x00007f2c48d44a9e in fork () from /lib64/libc.so.6
      
      My guess is that the fork happened at a very unfortunate moment where the "allocMutexPtr" in the parent process was temporarily locked. Should there not be a call at the beginning of "AtForkChild" that forces "allocInit" back to zero?
      
    5. foundin initialized to: "8.6.5"
    6. is_private initialized to: "0"
    7. login: "christian.nassau"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "3b279cda57135cd36d2c32c66396637342913651"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "christian.nassau"
    14. subsystem initialized to: "49. Threading"
    15. title initialized to: "Deadlock during fork in TclpAlloc"
    16. type initialized to: "Bug"
  2. Add attachment "forkhang.c" [f09c55f4cd] (rid 257929) by serhiy.storchaka on 2026-10-13 16:13:20.

  3. Ticket change [60272ca205] (rid 257933) by serhiy.storchaka on 2026-10-13 16:15:15:

    1. foundin changed to: "9.1.0"
    2. icomment:
      Still happens with 9.1, now in <code>GetCache()</code> of the threaded
      allocator: if another thread holds a lock of the allocator when
      <code>fork()</code> is called, the child inherits the lock in the locked state,
      and its first allocation that needs it never returns. With the attached
      forkhang.c, where threads allocate and exit while another thread forks, 37 of
      120000 children hung.
      
      Proposed fix in branch [/timeline?r=alloc-fork-deadlock|alloc-fork-deadlock]:
      hold all allocator locks across <code>fork()</code> with
      <code>pthread_atfork()</code>.
      
    3. login: "serhiy.storchaka"
    4. mimetype: "text/x-fossil-wiki"
  4. Ticket change [3cc70373d2] (rid 261427) by jan.nijtmans on 2026-11-11 14:19:34:

    1. assignee changed to: "jan.nijtmans"
    2. login: "jan.nijtmans"
    3. mimetype: "text/plain"