Skip to content
Tcl Source Code History Of Ticket 1082283
Login

History Of Ticket 1082283

Artifacts Associated With Ticket 1082283

  1. Ticket change [e2514793c3] (rid 87602) by doko on 2004-12-09 17:11:34:

    1. assignee initialized to: "andreas_kupries"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      tcl8.4.7 (and current 8.4 branch) segfault when running
      on Linux 2.6 kernels on machines with 2 or more
      processors. 
      
      It takes several runs to reproduce sometimes and gdb
      isn't very helpful.
      
      (gdb) run ./www/c_interface.tcl >c_interface.html
      Starting program:
      /home/james/scratch/tcl8.4/tcl8.4-8.4.7/unix/tclsh
      ./www/c_interface.tcl >c_interface.html
      [Thread debugging using libthread_db enabled]
      [New Thread 1076113536 (LWP 14342)]
      [New Thread 1084509104 (LWP 14343)]
      
      Program received signal SIGSEGV, Segmentation fault.
      [Switching to Thread 1076113536 (LWP 14342)]
      0x4000c410 in _dl_fini () from /lib/ld-linux.so.2
      (gdb) bt
      #0  0x4000c410 in _dl_fini () from /lib/ld-linux.so.2
      #1  0x4013490f in exit () from /lib/tls/i686/cmov/libc.so.6
      #2  0x40069b44 in Tcl_Exit () from /usr/lib/libtcl8.4.so.0
      #3  0x4004a3b5 in Tcl_ExitObjCmd () from
      /usr/lib/libtcl8.4.so.0
      #4  0x40044604 in TclEvalObjvInternal () from
      /usr/lib/libtcl8.4.so.0
      #5  0x400451b4 in Tcl_EvalEx () from
      /usr/lib/libtcl8.4.so.0
      #6  0x4004563b in Tcl_Eval () from /usr/lib/libtcl8.4.so.0
      #7  0x4008eafe in Tcl_Main () from /usr/lib/libtcl8.4.so.0
      #8  0x08048733 in main (argc=134512916, argv=0x8048114)
      at ../unix/tclAppInit.c:90
      (gdb)
      
      Disabling TLS (LD_ASSUME_KERNEL=2.4.21) seems to 'fix' it.
      
      The problematic change appears to be this:
      
              * unix/tclUnixNotfy.c (NotifierThreadProc):
      Accepted Joe
                Mistachkin's patch for [Tcl SF Bug 990500],
      properly closing the
                notifier thread when its exits.
      
      cf.
      http://sourceforge.net/tracker/?group_id=10894&atid=110894&func=detail&aid=990500
      
      If I revert that patch, I can longer reproduce the
      segfault, even with 10,000 iterations.
      
      See https://bugzilla.ubuntu.com/show_bug.cgi?id=4141
      for the original bug report.
      
      
    4. foundin initialized to: "obsolete: 8.4.9"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "doko"
    9. subsystem initialized to: "49. Threading"
    10. title initialized to:
      tcl8.4 segfaults running on linux-2.6 with SMP machines
      
    11. type initialized to: "Bug"
  2. Ticket change [3a98085ed3] (rid 112582) by hobbs on 2004-12-10 02:58:53:

    1. assignee changed to: "mistachkin"
    2. icomment:
      Logged In: YES 
      user_id=72656
      
      Joe needs to do more testing of his recommended core patches
      for the exit shutdown.
      
      
    3. login: "hobbs"
    4. mimetype: "text/plain"
    5. priority changed to: "9 Immediate"
    6. username: "hobbs"
  3. Ticket change [3716e5f938] (rid 107217) by mistachkin on 2004-12-23 14:20:50:

    1. icomment:
      Logged In: YES 
      user_id=113501
      
      Can anybody duplicate this bug on some non-Linux nix
      platform with 2 or more processors?
      
      We need to figure out if this problem is specific to Linux.
      
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
    4. username: "mistachkin"
  4. Ticket change [eb1bb3eb06] (rid 103479) by mistachkin on 2004-12-23 14:22:06:

    1. icomment:
      Logged In: YES 
      user_id=113501
      
      
      This bug may be related to bug #1011715.
      
      
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
    4. username: "mistachkin"
  5. Ticket change [7105da43b1] (rid 100598) by mistachkin on 2005-03-03 14:28:39:

    1. assignee changed to: "hobbs"
    2. icomment:
      Logged In: YES 
      user_id=113501
      
      I do not believe my patch is [directly] causing this issue.
      
      This appears to be happening at process termination.
      
      I have a theory on how to fix this problem.
      
      In "tclUnixNotfy.c", near line 303 we have:
      
          Tcl_MutexUnlock(&notifierMutex);
      
      I suggest we add the following after this code:
      
          /*
           * Avoid possible race condition, physically wait for
      thread to die.
           */
          Tcl_JoinThread(notifierThread);
      
      This should avoid a [potential] race condition between the
      process terminating (due to a premature return from
      Tcl_FinalizeNotifier) and the notifier thread actually
      calling TclpThreadExit.
      
      
      
    3. login: "mistachkin"
    4. mimetype: "text/plain"
    5. username: "mistachkin"
  6. Ticket change [464ff6636e] (rid 99498) by mistachkin on 2005-03-06 13:10:54:

    1. icomment:
      Logged In: YES 
      user_id=113501
      
      
      The Tcl_CreateThread call for the notifier thread will also
      need the TCL_THREAD_JOINABLE flag.
      
      Near line 222 of tclUnixNotfy.c:
      
      if (TclpThreadCreate(&notifierThread, NotifierThreadProc,
      NULL, TCL_THREAD_STACK_DEFAULT, TCL_THREAD_NOFLAGS) != TCL_OK) {
      Tcl_Panic("Tcl_InitNotifier: unable to start notifier thread");
      }
      
      
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
    4. username: "mistachkin"
  7. Ticket change [7ffa38ec5b] (rid 97658) by hobbs on 2005-05-31 09:12:42:

    1. assignee changed to: "vasiljevic"
    2. priority changed to: "8"
  8. Ticket change [83769b4237] (rid 117385) by vasiljevic on 2005-05-31 14:29:25:

    1. icomment:
      Logged In: YES 
      user_id=95086
      
      I'm not 100% sure if this is going to fix the problem
      but Joe is right about the notifier thread termination.
      It is more clean to join the exiting notifier thread.
      
      There is an ever-lasting problem with proper termination
      of Tcl shell process with threads enabled. If you just 
      exit() the process *while* there are still some threads
      running, you might get a core. This is not only related 
      to the notifier thread but for threads in general. The 
      reason is in the Tcl library design and has been observed
      and reported several times already (Bug #597575).
      The problem is not easy to solve but we can certainly close
      this subtle race condition by joining the notifier thread.
      I will add this into both core-8-4-branch and head branch today
      and the poster of the bug-ticket should try to reproduce the
      problem, if possible, as I do not have MP-linux box here. I have
      MP-Darwin and MP-Solaris boxes and I've not observed any
      problem there, provided all threads have been terminated before
      the exit() is called.
      I will leave this ticket open after applying the changes until we
      prove it solves the issue or not.
      
      
    2. login: "vasiljevic"
    3. mimetype: "text/plain"
    4. username: "vasiljevic"
  9. Ticket change [88efbfe83a] (rid 131943) by vasiljevic on 2005-06-21 02:49:51:

    1. icomment:
      Logged In: YES 
      user_id=95086
      
      This patch has been  incorporated in 8.4.10 but I broke
      the code by compiling with new gcc 4.0.0 on MacOSX.
      Hence...
      I'd like to ask the original poster to try to reproduce 
      the bug again if possible by giving it a try against the
      8.4.11 which will soon be released (or by checking out 
      the core-8-4-branch).
      I will keep this bug opened for 4 weeks after the 8.4.11
      release and if nobody responds, I will consider this one
      solved and will close this ticket. 
      
      
    2. login: "vasiljevic"
    3. mimetype: "text/plain"
    4. username: "vasiljevic"
  10. Ticket change [07b6a685fc] (rid 89454) by dkf on 2005-06-21 16:02:20:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      Just a general note: if you've got glibc 2.3.2, you should
      set LD_ASSUME_KERNEL to 2.4.19 to work around other
      threading bugs (in glibc) that have been found to impact on
      Tcl. Note that this trick also stabilizes other applications
      that make use of threads (e.g. it's helping keep my Java
      applications from locking up). This advice only applies to
      glibc 2.3.2, but that's disappointingly common still...
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  11. Ticket change [9e0845f399] (rid 96408) by mic42 on 2006-06-22 06:15:00:

    1. icomment:
      Logged In: YES 
      user_id=302287
      
      Not sure if its the same or similar problem, but i see
      Segfaults when running 'make test' on a SuSE 10.1 x86_64
      machine, compiling against Tcl 8.5a4 from CVS.
      
      Its an SMP kernel 2.6.19, glibc 2.4, gcc 4.1.0.
      
      The segfault vanishes when i use --enable-symbols while
      compiling the thread package (2.6.3 from cvs), but happens
      every time when leaving out symbols.
      
      
      
      
      
      
    2. login: "mic42"
    3. mimetype: "text/plain"
    4. username: "mic42"
  12. Ticket change [b15c0923a8] (rid 98132) by ferrieux on 2011-09-24 05:09:21:

    1. icomment:
      Sounds completely outdated. So much has been done since then, in both process termination and thread safety, that the odds are high that it's fixed by now.
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  13. Ticket change [c10dae4318] (rid 111259) by ferrieux on 2011-09-24 05:09:22:

    1. closedate changed to: "2011-09-23T22:09:22"
    2. closer changed to: "ferrieux"
    3. resolution changed to: "Fixed"
    4. status changed to: "Pending"
  14. Ticket change [c066671b53] (rid 134174) by dkf on 2013-09-24 12:05:31:

    1. closedate changed to: "2456560.00383998"
    2. closer changed to: "dkf"
    3. comment changed to:
      tcl8.4.7 (and current 8.4 branch) segfault when running
      on Linux 2.6 kernels on machines with 2 or more
      processors. 
      
      It takes several runs to reproduce sometimes and gdb
      isn't very helpful.
      
      (gdb) run ./www/c_interface.tcl >c_interface.html
      Starting program:
      /home/james/scratch/tcl8.4/tcl8.4-8.4.7/unix/tclsh
      ./www/c_interface.tcl >c_interface.html
      [Thread debugging using libthread_db enabled]
      [New Thread 1076113536 (LWP 14342)]
      [New Thread 1084509104 (LWP 14343)]
      
      Program received signal SIGSEGV, Segmentation fault.
      [Switching to Thread 1076113536 (LWP 14342)]
      0x4000c410 in _dl_fini () from /lib/ld-linux.so.2
      (gdb) bt
      #0  0x4000c410 in _dl_fini () from /lib/ld-linux.so.2
      #1  0x4013490f in exit () from /lib/tls/i686/cmov/libc.so.6
      #2  0x40069b44 in Tcl_Exit () from /usr/lib/libtcl8.4.so.0
      #3  0x4004a3b5 in Tcl_ExitObjCmd () from
      /usr/lib/libtcl8.4.so.0
      #4  0x40044604 in TclEvalObjvInternal () from
      /usr/lib/libtcl8.4.so.0
      #5  0x400451b4 in Tcl_EvalEx () from
      /usr/lib/libtcl8.4.so.0
      #6  0x4004563b in Tcl_Eval () from /usr/lib/libtcl8.4.so.0
      #7  0x4008eafe in Tcl_Main () from /usr/lib/libtcl8.4.so.0
      #8  0x08048733 in main (argc=134512916, argv=0x8048114)
      at ../unix/tclAppInit.c:90
      (gdb)
      
      Disabling TLS (LD_ASSUME_KERNEL=2.4.21) seems to 'fix' it.
      
      The problematic change appears to be this:
      
              * unix/tclUnixNotfy.c (NotifierThreadProc):
      Accepted Joe
                Mistachkin's patch for [Tcl SF Bug 990500],
      properly closing the
                notifier thread when its exits.
      
      cf.
      http://sourceforge.net/tracker/?group_id=10894&atid=110894&func=detail&aid=990500
      
      If I revert that patch, I can longer reproduce the
      segfault, even with 10,000 iterations.
      
      See https://bugzilla.ubuntu.com/show_bug.cgi?id=4141
      for the original bug report.
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. severity changed to: "Severe"
    7. status changed to: "Closed"