Skip to content
Tcl Source Code History Of Ticket 103abf181eb01366
Login

History Of Ticket 103abf181eb01366

Artifacts Associated With Ticket 103abf181eb01366

  1. Ticket change [dd65bf7555] (rid 261774) by dgp on 2026-11-16 15:02:47:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      $ cd tcl9.0.5/unix
      $ ./configure --disable-shared --enable-symbols=mem
      ...
      $ make
      ...
      $ make tcltest
      ...
      $ make test-packages
      ...
      Testing package 'itcl4.3.8'
      ...
      Tests began at 2026-11-16 09:56:04 EST
      basic.test
      ...
      widgetadaptor.test
      LEAKED: 25365 bytes
      
      
      and there it hangs.
      
      
      This was working in the Tcl 9.0.4 release, which included the same Itcl 4.3.8
      
    5. foundin initialized to: "9.0.5"
    6. is_private initialized to: "0"
    7. login: "dgp"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "8e2300e85be5dd1445b9666eb9429055951e33be"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "dgp"
    14. subsystem initialized to: "None"
    15. title initialized to:
      regression since 9.0.4 brings leaks and hangs to bundled Itcl 4.3.8
      
    16. type initialized to: "Bug"
  2. Ticket change [6a3ab648c2] (rid 261775) by dgp on 2026-11-16 15:19:35:

    1. icomment:
      Bisecting finds the origin of the failure
      
      2026-10-22 11:44:24 e44f1d0e87 BAD CURRENT
      2026-10-21 10:58:34 ff7935f994 GOOD
      
      This blames 
      
      checkout:     e44f1d0e8723fa8810ccbcc6f873f78fcb2bab26 2026-10-22 11:44:24 UTC
      parent:       ff7935f9946df91c93f8b98e8d153476ff9addfe 2026-10-21 10:58:34 UTC
      child:        d6c0fa08a86069cff1ec134d991effd66923b686 2026-10-23 20:28:32 UTC
      tags:         core-9-0-branch
      comment:      Many tcltest improvements, [773924ffff], [811659ffff],
                    [572400ffff], [8413e79232] and [1528500fff] (user: jan.nijtmans)
      
      Which seems odd and unlikely.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  3. Ticket change [9383fe00d3] (rid 261776) by dgp on 2026-11-16 15:58:15:

    1. icomment:
      
      The trunk exhibits the same failure, and it originates in
      the corresponding checkin.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  4. Ticket change [257230a4b3] (rid 261780) by serhiy.storchaka on 2026-11-16 17:52:41:

    1. icomment:
      This is not a new bug: fixing [8413e79232] in [e44f1d0e87] exposed existing problems that the old tcltest behaviour had hidden.
      
      Before, <tt>cleanupTests</tt> called <tt>exit</tt> in any interpreter where Tk was loaded. Itcl's <tt>tests/helpers.tcl</tt> runs each test file three times in a child interpreter to look for leaks. So in widgetadaptor.test and widgetclass.test the whole process exited after the first run, and three problems went unnoticed:
      <ul>
      <li>the other two runs never happened, so 118 tests were silently skipped (2255 instead of 2373);</li>
      <li>the leak check never completed: the Tk widget tests leak 17149 bytes (widgetadaptor.test) and 12880 bytes (widgetclass.test) per run in a child interpreter;</li>
      <li>helpers.tcl ends with <tt>return -code return</tt> and relied on that exit to end the process. Without it, the process waits in Tk's event loop.</li>
      </ul>
      Since [e44f1d0e87], tcltest no longer exits when a test file is sourced by another script, which is correct. All three runs complete, the leak is reported, and the process hangs.
      
      This only shows when Tk can be loaded by the test processes; without Tk the Itcl tests pass. With <tt>exit</tt> instead of <tt>return -code return</tt> at the end of the leak-test branch in helpers.tcl, all 2373 Itcl tests pass and nothing hangs. The leaks are still reported and need a separate look, in Tk or in Itcl's widget code.
      
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
  5. Ticket change [7a04d7c6e2] (rid 261781) by serhiy.storchaka on 2026-11-16 22:17:57:

    1. icomment:
      The hang is caused by Itcl's leak-test harness. widgetadaptor.test and widgetclass.test set their <tt>tk</tt> constraint with <tt>package require Tk</tt> in the main interpreter before calling <tt>loadTestedCommands</tt>. In the leak-test mode, tests/helpers.tcl runs the file in child interpreters and stops the main one with <tt>return -code return</tt>, but the main interpreter's Tk main window stays. When the script ends, <tt>Tcl_Main</tt> enters the Tk event loop and waits forever. The old tcltest hid this by exiting from the child interpreter.
      
      This patch to Itcl destroys that window after the leak test:
      
      <verbatim>
      --- tests/helpers.tcl
      +++ tests/helpers.tcl
      @@ -42,7 +42,14 @@
           if {$leak} {
             puts "LEAKED: $leak bytes"
           }
         }
         itcl_leaktest [info script]
      +  # The test file may have loaded Tk in this interpreter (to set its tk
      +  # constraint) before calling loadTestedCommands. Destroy its main
      +  # window, or the application would wait in the Tk event loop when the
      +  # script ends.
      +  if {[info commands ::destroy] ne ""} {
      +    destroy .
      +  }
         return -code return
       }
      </verbatim>
      
      With it, all 2373 Itcl 4.3.8 tests pass with Tk available and nothing hangs. The leak check still reports 17149 bytes for widgetadaptor.test and 12880 bytes for widgetclass.test.
      
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
  6. Ticket change [0386ec4148] (rid 261782) by serhiy.storchaka on 2026-11-16 23:30:24:

    1. icomment:
      The reported leaks have three sources:
      <ul>
      <li>Not real leaks: queued window events of the deleted child interpreter, freed once events are processed. Fix: <tt>update</tt> after <tt>interp delete i</tt> in helpers.tcl.</li>
      <li>Itcl: several Tcl_Objs and argument arrays not freed in widgetadaptor and widget code (itclObject.c, itclParse.c, itclBuiltin.c).</li>
      <li>Tk: every Tk_Init adds another thread exit handler, 24 bytes per interpreter that loads Tk; see Tk ticket [https://core.tcl-lang.org/tk/tktview/703a7fdda7|703a7fdda7].</li>
      </ul>
      With fixes for the first two, all 2373 Itcl tests pass with Tk, and the leak check reports only noise.
      
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
  7. Ticket change [e7fbb39911] (rid 261783) by serhiy.storchaka on 2026-11-17 00:01:53:

    1. icomment:
      The Itcl fixes, for the hang, the false leak reports and the leaks in the widget code, are in Itcl branch [https://core.tcl-lang.org/itcl/timeline?r=leaktest-hang-and-leaks|leaktest-hang-and-leaks] (Itcl ticket [https://core.tcl-lang.org/itcl/tktview/9c3f652f29|9c3f652f29]).
      
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
  8. Ticket change [97a0247888] (rid 261830) by jan.nijtmans on 2026-11-17 13:41:42:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2461362.0706335185"
    3. closer changed to: "jan.nijtmans"
    4. icomment:
      This is fixed in itcl 4.3.9
      
      Closing
      
      Many thanks for the quick reaction!
      
    5. login: "jan.nijtmans"
    6. mimetype: "text/x-fossil-wiki"
    7. resolution changed to: "Fixed"
    8. status changed to: "Closed"
  9. Ticket change [190bbc9b19] (rid 261835) by dgp on 2026-11-17 14:23:11:

    1. closedate changed to: "2461362.099437153"
    2. closer changed to: "dgp"
    3. icomment:
      
      In light of this experience, the changes.md file
      should be edited to highlight the incompatibilities
      of tcltest 2.6 that have the potential to break 
      deployed test suites.
      
    4. login: "dgp"
    5. mimetype: "text/plain"
  10. Ticket change [926ce5bc22] (rid 261836) by jan.nijtmans on 2026-11-17 14:41:41:

    1. closedate changed to: "2461362.1122860648"
    2. closer changed to: "jan.nijtmans"
    3. icomment:
      Well, Serhiy wrote:
      
      > This is not a new bug: fixing [8413e79232] in [e44f1d0e87] exposed existing problems that the old tcltest behaviour had hidden.
      
      So the problem has always been in Itcl, only there was a bug in the old tcltest which made the the testcases passed which should have failed. 
      
      Conclusion: it's not an incompatibility in tcltest, it was failure to detect a real problem.
      
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"