Tcl Source Code

View Ticket
Login
Ticket UUID: e484a8407cb9ec45ea0a6f3127ae4a3a1780b8a0
Title: pipe: time-related sporadic hangs in io/chan-io tests
Type: Bug Created on: 2019-08-04 22:38:51
Submitter: sebres Assigned to: sebres
Subsystem: 25. Channel System Severity: Minor
Priority: 5 Medium Last modified: 2026-10-14 10:29:15
Status: Open Closed by: nobody
Resolution: None Closed on:
Version: >= 8.5
Description:

Trying to fix all windows/mingw tests in travis, I found some sporadic hangs (io-27.6, io-29.32 etc), which are pretty reproducible if sleep times becomes reduced (after 20 will be replaced with after 1).

As one can see build # 567003451 is passed, and after some small changes the heisenbug is reproduced in all build jobs build # 567076288.

The shorter the sleep intervals, the better it is reproducible.

Here is the code to reproduce it in shell:

package require tcltest
namespace import -force ::tcltest::*
tcltest::configure -match io-29.32

proc ::tcltest::cleanupTestsHook {} { if {$::tcltest::numTests(Failed)} {error failed} } timerate {source tests/io.test} 10000

User Comments:
fvogel added on 2019-08-05 07:19:56:

I'm seeing a repeatable hang for (unmodified) chanio-29.34 on Windows, see [1adeb65446].


jan.nijtmans added on 2019-08-12 07:32:46:
Those test-case are marked knownMsvcBug now. That doesn't mean it's solved, but at least Travis builds don't fail any more for those test-cases, if they are the only ones failing: It should not block a release, since it's likely a long-time problem not a regression.

sebres added on 2019-08-22 10:02:23:

just as an interim info: this is not reproducible at all with RFE [fdfbd5e10] (together with fix for [815e246806], but I think it is not really affected here), seems to be fixed in RFE using ChannelScheduledEvent (previously timer-event) with new prolongation handling (retarding).


sebres added on 2019-08-23 12:27:15:

Nope, reproduced the hang also (with RFE [fdfbd5e10]) testing that in VM...
Just needed some more time (1h), possibly because the event-handling is several times faster there, so 1ms is "too" long (quasi same as not reduced "after 20" in original tcl-core).


sebres added on 2019-08-23 15:17:58:

Found it, branch core-8-5-branch-fix-1997007 with few small changes fixed it for win & mingw, so after fix (without RFE) got applied, I see no hangs anymore approximately within 1 hour testing (where it hung in at the latest in 10 seconds previously), so I'll rebase it to fossil and provide the fix soon.


serhiy.storchaka added on 2026-10-14 10:29:15:

The hangs do not reproduce on Windows 11 with 9.1 and 8.6, even with after 1 in the child scripts (over 1400 runs of io-27.6, io-29.32, chan-io-27.6 and chan-io-29.32).

With the shortened sleep the tests failed sporadically for another reason: they returned before the child closed the output file, so file delete $path(output) in the next test failed with "permission denied". The chan-io tests never ran at all: their constraint asyncPipeClose was mangled into "asyncPipeChan Close" when chanio.test was created.

Proposed fix in branch tests-async-pipe-close: the tests wait for a marker file the child creates after closing the output file, and the chan-io constraint is fixed. 1200 runs on Windows without failures.