Artifacts Associated With Ticket 103abf181e
Ticket change [dd65bf7555] (rid 261774) by dgp on 2026-11-16 15:02:47:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- 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
- foundin initialized to: "9.0.5"
- is_private initialized to: "0"
- login: "dgp"
- priority initialized to: "5 Medium"
- private_contact initialized to: "8e2300e85be5dd1445b9666eb9429055951e33be"
- resolution initialized to: "None"
- severity initialized to: "Important"
- status initialized to: "Open"
- submitter initialized to: "dgp"
- subsystem initialized to: "None"
- title initialized to:
regression since 9.0.4 brings leaks and hangs to bundled Itcl 4.3.8
- type initialized to: "Bug"
Ticket change [6a3ab648c2] (rid 261775) by dgp on 2026-11-16 15:19:35:
- 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. - login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [9383fe00d3] (rid 261776) by dgp on 2026-11-16 15:58:15:
- icomment:
The trunk exhibits the same failure, and it originates in the corresponding checkin.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [257230a4b3] (rid 261780) by serhiy.storchaka on 2026-11-16 17:52:41:
- 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.
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [7a04d7c6e2] (rid 261781) by serhiy.storchaka on 2026-11-16 22:17:57:
- 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. - login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [0386ec4148] (rid 261782) by serhiy.storchaka on 2026-11-16 23:30:24:
- 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.
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [e7fbb39911] (rid 261783) by serhiy.storchaka on 2026-11-17 00:01:53:
- 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]).
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [97a0247888] (rid 261830) by jan.nijtmans on 2026-11-17 13:41:42:
- assignee changed to: "jan.nijtmans"
- closedate changed to: "2461362.0706335185"
- closer changed to: "jan.nijtmans"
- icomment:
This is fixed in itcl 4.3.9 Closing Many thanks for the quick reaction!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [190bbc9b19] (rid 261835) by dgp on 2026-11-17 14:23:11:
- closedate changed to: "2461362.099437153"
- closer changed to: "dgp"
- 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.
- login: "dgp"
- mimetype: "text/plain"
Ticket change [926ce5bc22] (rid 261836) by jan.nijtmans on 2026-11-17 14:41:41:
- closedate changed to: "2461362.1122860648"
- closer changed to: "jan.nijtmans"
- 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.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"