Skip to content
Tcl Source Code History Of Ticket 3408127fffffffff
Login

History Of Ticket 3408127fffffffff

Artifacts Associated With Ticket 3408127fffffffff

  1. Ticket change [2f0c78e9e2] (rid 92988) by dgp on 2011-09-12 16:05:44:

    1. assignee initialized to: "mistachkin"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      
      The following tests leak memory:
      
      thread-7.24
      thread-7.25
      thread-7.26
      thread-7.28
      thread-7.29
      thread-7.30
      thread-7.31
      
      The cause is the same in all of them.  The tests make
      use of the [testthread exit] command both directly and
      indirectly via the [tcltest::threadReap] command.  This
      command unavoidably causes leaks.  For this reason
      the corresponding Thread command [thread::exit] is
      declared deprecated.
      
      I've successfully converted many tests from [testthread]
      to the Thread package, making use of the [thread::preserve]
      and [thread::release] commands to manage thread lifetimes
      without leaking memory.  I'm not able to convert the tests
      above though.
      
      These tests are testing Tcl_CancelEval via both the
      [interp cancel] command and a [testthread cancel] testing
      command. I've tried to convert these, but I cause 
      intermittent segfaults with my attempts.  My hope is
      that my failures are due to lack of experience with
      cancel, and the matter will be easy for those who know it.
      
    4. foundin initialized to: "obsolete: 8.6b2"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    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: "several thread-7.* tests leak"
    12. type initialized to: "Bug"
  2. Ticket change [fbce8a9b65] (rid 108124) by dgp on 2011-09-12 23:08:41:

    1. icomment:
      BTW, the fact that I can trigger segfaults
      with scripts, even by accident, suggests
      there's some pretty serious bugs in either
      the *Cancel* machinery or the Thread package
      or both or their combination.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. priority changed to: "8"
    5. username: "dgp"
  3. Ticket change [2557cd3f8d] (rid 88155) by dgp on 2011-11-18 03:42:55:

    1. icomment:
      
      I've been working on converting the
      thread-7.* tests from using the [testthread]
      command to the Thread package.  At the
      same time, I've been trying to eliminate
      the empirical use of [after] delays, and put
      in place whatever sync is needed to make
      the tests robust.
      
      I've got problems.
      
      First, I haven't been able to come
      up with a solution when the object
      is to test that some script is not
      cancelled.  For example thread-7.18.
      
      Second, I've come to discover that when
      I removed some [after]s, even the passing
      tests are not actually demonstrating successul
      cancel of the code intended to get canceled.
      Often, the cancel is happening while the
      thread::send is still in progress.
      
      I need help with this.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  4. Ticket change [70f9f3d479] (rid 100584) by mistachkin on 2011-11-18 08:54:55:

    1. icomment:
      Fixing these issues requires a couple more minor enhancements to the Thread package.  I'm working on them now.
      
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
    4. username: "mistachkin"
  5. Ticket change [1749efcc09] (rid 122462) by mistachkin on 2011-11-18 12:06:39:

    1. icomment:
      All of these tests have been fixed.  Please verify and close this bug.  If there are any additional issues, please let me know.
      
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
    4. username: "mistachkin"
  6. Ticket change [f7594433d8] (rid 91363) by mistachkin on 2011-11-18 12:07:29:

    1. icomment:
      Also, note that you need the very latest version of the Thread package (currently the tip of the thread-2-7-branch branch) in order for all the tests to pass.
      
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
    4. username: "mistachkin"
  7. Ticket change [0cc488ae55] (rid 114234) by mistachkin on 2011-11-18 14:28:15:

    1. icomment:
      Careful analysis of ThreadEventProc in threadCmd.c reveals that in some cases it is neglecting to Tcl_Release the Tcl interp inside eventPtr->clbkData.  I'm still trying to fully understand all possible paths through this function in my head.
      
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
    4. username: "mistachkin"
  8. Ticket change [21d3d1239f] (rid 130650) by dgp on 2012-07-13 01:04:42:

    1. assignee changed to: "ferrieux"
    2. foundin changed to: "obsolete: 8.5.12"
    3. icomment:
      Here's the ticket where the troublesome tests have
      been worked on.  Here's output testing the 8.6b3
      RC, all trimmed away except the interesting bits:
      
      ---- thread-7.26 start
      WARNING: drained 1 event(s) on main thread
      ++++ thread-7.26 PASSED
      ...
      ---- thread-7.28 start
      
      
      ==== thread-7.28 cancel: send async cancel nested catch inside pure bytecode loop FAILED
      ==== Contents of test case:
      
          unset -nocomplain ::threadSawError ::threadError ::threadId ::threadIdStarted
          set serverthread [thread::create -joinable  [string map [list %ID% [thread::id]] {
              proc foobar {} {
                  while {1} {
                      if {![info exists foo]} then {
                          # signal the primary thread that we are ready
                          # to be canceled now (we are running).
                          thread::send %ID% [list set ::threadIdStarted [thread::id]]
                          set foo 1
                      }
                      catch {
                          while {1} {
                              catch {
                                  while {1} {
                                      # we must call update here because otherwise
                                      # the thread cannot even be forced to exit.
                                      update
                                  }
                              }
                          }
                      }
                  }
              }
              foobar
          }]]
          # wait for other thread to signal "ready to cancel"
          vwait ::threadIdStarted; after 1000
          set res [thread::send -async $serverthread {interp cancel}]
          thread::send $serverthread $::threadSuperKillScript
          vwait ::threadSawError($serverthread)
          thread::join $serverthread; drainEventQueue
          list $res [expr {[info exists ::threadIdStarted] ?  $::threadIdStarted == $serverthread : 0}]  [expr {[info exists ::threadId] ?  $::threadId == $serverthread : 0}]  [expr {[info exists ::threadError($serverthread)] ?  [findThreadError $::threadError($serverthread)] : ""}]
      
      ---- Test generated error; Return code was: 1
      ---- Return code should have been one of: 0 2
      ---- errorInfo: target thread died
          while executing
      "thread::send $serverthread $::threadSuperKillScript"
          ("uplevel" body line 30)
          invoked from within
      "uplevel 1 $script"
      ---- errorCode: NONE
      ==== thread-7.28 FAILED
      
      
      ---- thread-7.29 start
      WARNING: drained 1 event(s) on main thread
      ++++ thread-7.29 PASSED
      ---- thread-7.30 start
      WARNING: drained 1 event(s) on main thread
      ++++ thread-7.30 PASSED
      ---- thread-7.31 start
      WARNING: drained 1 event(s) on main thread
      ++++ thread-7.31 PASSED
      ...
      ---- thread-7.34 start
      WARNING: drained 1 event(s) on main thread
      ++++ thread-7.34 PASSED
      ---- thread-7.35 start
      WARNING: drained 1 event(s) on main thread
      ++++ thread-7.35 PASSED
      ---- thread-7.36 start
      WARNING: drained 1 event(s) on main thread
      ++++ thread-7.36 PASSED
      ---- thread-7.37 start
      WARNING: drained 1 event(s) on main thread
      ++++ thread-7.37 PASSED
      
      The WARNINGs are reportedly evidence of pthread
      misbehavior.  The single failure in this run is only one
      possible outcome.  As few as zero and as many as 4
      test failures are common possibilities.
      
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. username: "dgp"
  9. Ticket change [9d1ce29089] (rid 96254) by ferrieux on 2012-07-13 01:11:31:

    1. icomment:
      Can someone write a comment here, explaining what libpthread is supposed to be doing wrong ?
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  10. Ticket change [c6c71acc91] (rid 121824) by mistachkin on 2012-07-13 01:22:05:

    1. icomment:
      It's actually hard to pin down exactly what pthreads is doing incorrectly.  If I remember correctly, it was "losing" events in some cases.  There is also an issue with spurious events; however, I think that was related to the Tcl event loop processing code.  Another question: Are the actual leaks originally reported in this bug gone now?
      
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
    4. username: "mistachkin"
  11. Ticket change [35d302b5f7] (rid 107005) by ferrieux on 2012-07-13 01:58:39:

    1. assignee changed to: "vasiljevic"
    2. icomment:
      Sorry, I lack the bandwidth to reconsider the whole bug ecosystem. I am not a user of Tcl threads, my experience is with libpthread in other (non-Tcl) contexts, hence my offer to help. I'm still eager to help if the spotlight focuses on libpthread at some point, but reassigning to Zoran in the meantime.
      
      
    3. login: "ferrieux"
    4. mimetype: "text/plain"
    5. username: "ferrieux"
  12. Ticket change [3db54f243e] (rid 121132) by dgp on 2012-07-13 03:00:52:

    1. assignee changed to: "ferrieux"
    2. icomment:
      I should find time to run valgrind again to be certain,
      but my recollection is that thread.test is now leak free.
      
      It's noisy and failure-prone, but it doesn't leak memory.
      
      
    3. login: "dgp"
    4. mimetype: "text/plain"
    5. username: "dgp"
  13. Ticket change [37149ae89b] (rid 107216) by ferrieux on 2012-07-13 03:42:19:

    1. assignee changed to: "vasiljevic"
  14. Ticket change [c42961697a] (rid 111792) by mistachkin on 2012-07-13 10:09:46:

    1. icomment:
      These test failures do not appear to reproduce on core.tcl.tk, nor do they reproduce on Windows using the trunk of Tcl and the thread-2-7-branch branch of the Thread package.
      
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
    4. username: "mistachkin"
  15. Ticket change [393dc23091] (rid 112358) by dgp on 2012-07-16 20:21:24:

    1. assignee changed to: "ferrieux"
    2. icomment:
      
      Thanks for checking.  I will find time to see whether I
      can better demonstrate the issues, or figure out what
      the trouble is.
      
      If I cannot succeed in communicating to you the problems
      needing solving, then I'm inclined to just revert as much of
      thread.test as necessary to what "worked" before in the interest
      of getting 8.6b3 done.
      
      
      
    3. login: "dgp"
    4. mimetype: "text/plain"
    5. username: "dgp"
  16. Ticket change [6a17544fc5] (rid 128087) by ferrieux on 2012-07-16 20:58:35:

    1. assignee changed to: "vasiljevic"
    2. icomment:
      Wondering why this gets repeatedly reassigned to me ... I'm handing it back to Zoran because he's (1) the obvious expert and (2) got some free cycles for Tcl these days (or so it seems).
      
      
    3. login: "ferrieux"
    4. mimetype: "text/plain"
    5. username: "ferrieux"
  17. Ticket change [821b2415cc] (rid 117172) by dgp on 2012-07-16 21:01:22:

    1. icomment:
      Apologies ferrieux.  That looks like a SF Tracker bug
      that I'm triggering.  I keep this ticket open in a Browser
      tab, and although I get comment updates via some
      browser magic, my form data values remain the same,
      so whenever I submit a comment, my outdated values
      get posted too.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  18. Ticket change [3c159a4060] (rid 120857) by stwo on 2012-07-16 21:38:59:

    1. icomment:
      All tests pass on OpenBSD-current using the trunk of Tcl and the thread-2-7-branch branch of the Thread package.
      
      
    2. login: "stwo"
    3. mimetype: "text/plain"
    4. username: "stwo"
  19. Ticket change [e0e1545343] (rid 87353) by dgp on 2012-07-16 21:47:23:

    1. icomment:
      Be sure to check before claiming "All tests pass".
      
      For at least some folks having no trouble with thread.test,
      it's not because "All tests pass" but because "All tests skipped".
      
      In particular, a working, [package require]-able Thread 2.7 has
      to be around for the troublesome tests to even be attempted.
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  20. Ticket change [14539e0ffa] (rid 124377) by stwo on 2012-07-16 23:05:06:

    1. icomment:
      Latest greatest Tcl and Thread 2.7 on OpenBsd-amd64-current:
      
      Tests began at Mon Jul 16 12:02:23 EDT 2012
      thread.test
      WARNING: drained 1 event(s) on main thread
      WARNING: drained 1 event(s) on main thread
      WARNING: drained 1 event(s) on main thread
      WARNING: drained 1 event(s) on main thread
      WARNING: drained 1 event(s) on main thread
      WARNING: drained 1 event(s) on main thread
      WARNING: drained 1 event(s) on main thread
      WARNING: drained 1 event(s) on main thread
      WARNING: drained 1 event(s) on main thread
      
      Tests ended at Mon Jul 16 12:02:38 EDT 2012
      all.tcl:        Total   51      Passed  49      Skipped 2       Failed  0
      Sourced 1 Test Files.
      Number of tests skipped for each constraint:
              2       knownBug
      
      
    2. login: "stwo"
    3. mimetype: "text/plain"
    4. username: "stwo"
  21. Ticket change [a721dbdb57] (rid 98730) by dgp on 2012-07-16 23:27:50:

    1. icomment:
      Thanks.  Now I want the WARNINGs to be gone.
      It's easy to silence them, but AIUI, mistachkin
      says their presence indicates malfunctioning he's 
      having to work around.  I don't want to kill the canaries
      if they're telling us something useful.
      
      Also, although I see runs like that one some of the time,
      I also see test failures.  These thread tests require several
      runs to see their whole spectrum of behaviors.
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  22. Ticket change [4a1c8f8720] (rid 126479) by nijtmans on 2012-07-17 03:18:22:

    1. icomment:
      Tried the same on UBUNTU amd64, and got
      the same 9 messsages, but no failures, even
      after serveral runs.
      
      How about silencing those messages in the
      8.6b3-rc branch, but not on trunk? That
      still gives some time to fix the 9 involved
      test-cases, but it doesn't need to hold
      the b3 release. (of course, when merging
      back the rc branch to trunk, this silencing
      must NOT be merged back!)
      
      ---- thread-7.26 start
      WARNING: drained 1 event(s) on main thread
      ---- thread-7.27 start
      ---- thread-7.28 start
      WARNING: drained 1 event(s) on main thread
      ---- thread-7.29 start
      WARNING: drained 1 event(s) on main thread
      ---- thread-7.30 start
      WARNING: drained 1 event(s) on main thread
      ---- thread-7.31 start
      WARNING: drained 1 event(s) on main thread
      ---- thread-7.32 start
      ---- thread-7.33 start
      ---- thread-7.34 start
      WARNING: drained 1 event(s) on main thread
      ---- thread-7.35 start
      WARNING: drained 1 event(s) on main thread
      ---- thread-7.36 start
      WARNING: drained 1 event(s) on main thread
      ---- thread-7.37 start
      WARNING: drained 1 event(s) on main thread
      
      Tests ended at Mon Jul 16 22:02:36 CEST 2012
      all.tcl:Total51Passed49Skipped2Failed0
      
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  23. Ticket change [19bd1d59d9] (rid 257773) by serhiy.storchaka on 2026-10-12 17:59:57:

    1. icomment:
      The thread-7.* tests no longer use <code>testthread exit</code>, and with 9.1 and
      Thread 3.0.7 they pass in 10 runs out of 10. Valgrind shows no leaks in Tcl. The
      only remaining leak (12 bytes) is in the Thread package: the result copied by
      <code>ThreadSetResult()</code> is sometimes not freed when the script is
      cancelled.
      
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"
  24. Ticket change [2ca42adc0f] (rid 259894) by serhiy.storchaka on 2026-10-22 17:19:24:

    1. closedate changed to: "2461326.2499744445"
    2. closer changed to: "serhiy.storchaka"
    3. login: "serhiy.storchaka"