Skip to content
Tcl Source Code History Of Ticket 2981154
Login

History Of Ticket 2981154

Artifacts Associated With Ticket 2981154

  1. Ticket change [ae9057143b] (rid 101663) by dgp on 2010-04-02 15:11:17:

    1. assignee initialized to: "andreas_kupries"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      
      Using the 8.5.8 sources (so I rule out more recent commits)
      and with a --enable-threads --enable-symbols build, I
      sometimes see a segfault at the end of async.test.
      
      I managed to catch it in gdb:
      
      Program received signal SIGSEGV, Segmentation fault.
      [Switching to Thread 0x40646b90 (LWP 825)]
      0x0814bcfb in Tcl_MutexLock (mutexPtr=0x10)
          at /home/dgp/cvs/tcl8.5/unix/../unix/tclUnixThrd.c:519
      519         if (*mutexPtr == NULL) {
      
      
      (gdb) bt
      #0  0x0814bcfb in Tcl_MutexLock (mutexPtr=0x10)
          at /home/dgp/cvs/tcl8.5/unix/../unix/tclUnixThrd.c:519
      #1  0x08067c88 in Tcl_AsyncMark (async=0x8e0b274)
          at /home/dgp/cvs/tcl8.5/unix/../generic/tclAsync.c:167
      #2  0x08054baf in AsyncThreadProc (clientData=0x8e16c18)
          at /home/dgp/cvs/tcl8.5/unix/../generic/tclTest.c:936
      #3  0x080c1fbd in NewThreadProc (clientData=0xbbe12f0)
          at /home/dgp/cvs/tcl8.5/unix/../generic/tclEvent.c:1487
      #4  0x0088773b in start_thread () from /lib/libpthread.so.0
      #5  0x007dccfe in clone () from /lib/libc.so.6
      
      
      Don't know whether this is another symptom of 
      Tcl Bug 2869384.
      
      I believe that when the segfault happens, it is
      always after test async-4.3 has failed
      (Tcl Bug 1774689).  However, async-4.3
      can also fail without a segfault following.
      
      
      
    4. foundin initialized to: "obsolete: 8.5.8"
    5. is_private initialized to: "0"
    6. priority initialized to: "9 Immediate"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "dgp"
    10. subsystem initialized to: "49. Threading"
    11. title initialized to: "async.test segfault"
    12. type initialized to: "Bug"
  2. Ticket change [ef702920a4] (rid 108994) by dgp on 2011-04-14 22:39:52:

    1. icomment:
      FWIW, I just saw this one again on trunk tip.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  3. Ticket change [60313d4ccc] (rid 115950) by ferrieux on 2011-08-19 04:44:01:

    1. icomment:
      Quoting mistachkin in 1774689:
      
         To see this test fail reliably, simply change the line in proc hang3
         from: [string repeat {;incr i;} 1500000] to: [string repeat {;incr i;}
         150]
      
      doing this I get it reliably on trunk tip.
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  4. Ticket change [03e70ef982] (rid 119903) by ferrieux on 2011-08-19 05:14:34:

    1. icomment:
      I also get non-systematic segfault, but there're news: the non-segfaulting is correlated to Tcl_AsyncMark *not* being called. It's an iff. So there's a race condition that hides the segfault by not letting the thread go far enough.
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  5. Ticket change [763be709d3] (rid 105543) by ferrieux on 2011-08-19 05:51:33:

    1. icomment:
      Probability of segfault gets close to 1 with 15 instead of 150 in the modified loop.
      Theory: the asyncmark may happen:
        (a) during the loopless stretch of BC 
        (b) during the main interp's teardown
        (c) not at all, since the process has exited
      Clearly only the gray area (b) segfaults. I guess during teardown things are not as airtight as during normal operation.
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  6. Ticket change [bb2ec2a979] (rid 129436) by ferrieux on 2011-08-19 05:59:27:

    1. icomment:
      Come to think of it, as mistachkin noted, the whole test setup is geared towards (a), ie there's absolutely no effort to be teardown-proof. So playing with too small stretches of BC is completely out of the intended range.
      Hence, I believe the proper fix is to increase the size of the loopless BC stretch in that test.
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  7. Ticket change [4b60dc48b8] (rid 126702) by ferrieux on 2011-08-19 13:56:14:

    1. icomment:
      To clarify: in the comments below, "teardown" is the test's cleanup part which does Tcl_AsyncDelete.
      So maybe there's a race condition between Tcl_AsyncDelete and the real invocation of an already Tcl_AsyncMark'ed handler. In case this is true, it ought to be fixed generically rather than pulled under the rug.
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  8. Ticket change [ea5a020825] (rid 103361) by ferrieux on 2011-08-19 13:59:59:

    1. icomment:
      OK, the previous hypothesis is proven wrong: the bug is really tclTest.c's lack of protection of its interthread data access. Will add a mutex.
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  9. Ticket change [e797b0a458] (rid 104487) by ferrieux on 2011-08-19 21:04:34:

    1. closedate changed to: "2011-08-19T14:04:34"
    2. closer changed to: "ferrieux"
    3. icomment:
      Fixed in HEAD, by (1) mutex-protecting the process-wide static holding the list of TestAsyncHandlers (along with the unique id counter ;-), and (2) moving from a pointer-to-struct to an integer-id API in async handlers. The mutex-protected lookup by id is done twice: once in the alien thread, as a prerequisite to calling AsyncMark with the proper token; and once in the async handler, since the handler may have been deleted between the two.
      Passes test suite. Verified that even wit the 1500000->15 tweak, even though the test consistently fails, it never segfaults.
      
      
    4. login: "ferrieux"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "ferrieux"
  10. Ticket change [3784d0241d] (rid 107292) by dgp on 2011-08-19 21:35:40:

    1. icomment:
      Is the patch suitable for backport
      to 8.5.11 ?
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  11. Ticket change [6d78635a7e] (rid 128703) by ferrieux on 2011-08-19 22:25:22:

    1. icomment:
      Backported.
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"