Skip to content

GHA/windows: try torture test - #19675

Closed
vszakats wants to merge 4 commits into
curl:masterfrom
vszakats:wtort
Closed

vszakats wants to merge 4 commits into
curl:masterfrom
vszakats:wtort

Conversation

@vszakats

Copy link
Copy Markdown
Member

No description provided.

@github-actions github-actions Bot added Windows Windows-specific CI Continuous Integration labels Nov 24, 2025
@vszakats
vszakats marked this pull request as draft November 24, 2025 21:11
@vszakats

Copy link
Copy Markdown
Member Author

Strange new failure:

Mon, 24 Nov 2025 20:42:15 GMT test 0828...[IMAP OAuth 2.0 (XOAUTH2) authentication with initial response]
Mon, 24 Nov 2025 20:42:15 GMT 126 functions found, but only fail 25 (19.84%)
Mon, 24 Nov 2025 20:42:15 GMT torture OK
Mon, 24 Nov 2025 20:43:08 GMT      0 [main] perl (2976) child_copy: cygheap read copy failed, 0x800000000..0x800016890, done 0, windows pid 2976, Win32 error 299
Mon, 24 Nov 2025 20:43:08 GMT      0 [main] perl 1974 dofork: child 52289 - died waiting for dll loading, errno 11
Mon, 24 Nov 2025 20:43:16 GMT Error: The action 'run tests' has timed out after 10 minutes.

@vszakats

Copy link
Copy Markdown
Member Author

troture seems to strike a nerve with MSYS2 fork:

Mon, 24 Nov 2025 21:32:18 GMT torture OK
Mon, 24 Nov 2025 21:32:18 GMT test 1139...[Verify that all libcurl options have man pages]
Mon, 24 Nov 2025 21:32:23 GMT       0 [main] perl 1054 dofork: child -1 - forked process 9792 died unexpectedly, retry 0, exit code 0xC000013A, errno 11
Mon, 24 Nov 2025 21:32:23 GMT Can't fork, trying again in 5 seconds at D:/a/curl/curl/tests/runner.pm line 552.
Mon, 24 Nov 2025 21:32:23 GMT       0 [main] perl 1055 dofork: child 64047 - died waiting for dll loading, errno 11
Mon, 24 Nov 2025 21:32:23 GMT Can't fork, trying again in 5 seconds at D:/a/curl/curl/tests/runner.pm line 552.
Mon, 24 Nov 2025 21:32:30 GMT Error: The operation was canceled.

https://github.com/curl/curl/actions/runs/19649534093/job/56272965785?pr=19675

@vszakats

vszakats commented Nov 24, 2025 •

Copy link
Copy Markdown
Member Author

Took 23m36s.

2 fallouts:

test 1498...[HTTP PUT from stdin using period]
 133 functions found, but only fail 25 (18.80%)
** MEMORY FAILURE
Leak detected: memory still allocated: 16 bytes
At 2622becea48, there is 16 bytes.
 allocated by D:/a/curl/curl/src/tool_doswin.c:830
Open file descriptor created at D:/a/curl/curl/src/tool_doswin.c:837
 1498: torture FAILED: function number 48 in test.
 invoke with "-t48" to repeat this single case.
== Contents of files in the log/6/ directory after test 1498
=== Start of file commands.log
 ../src/curl.exe -q --output log/6/curl1498.out  --include --trace-ascii log/6/trace1498 --trace-time http://127.0.0.1:55426/bzz/1498 -T . <log/6/stdin-for-1498 > log/6/stdout1498 2> log/6/stderr1498
=== End of file commands.log

https://github.com/curl/curl/actions/runs/19651206031/job/56278394121?pr=19675#step:13:3634

test 2300...[WebSockets upgrade only]
 126 functions found, but only fail 25 (19.84%)
** MEMORY FAILURE
Leak detected: memory still allocated: 16 bytes
At 162770f2498, there is 16 bytes.
 allocated by D:/a/curl/curl/src/tool_doswin.c:830
Open file descriptor created at D:/a/curl/curl/src/tool_doswin.c:837
 2300: torture FAILED: function number 35 in test.
 invoke with "-t35" to repeat this single case.
== Contents of files in the log/3/ directory after test 2300
=== Start of file commands.log
 ../src/curl.exe -q --output log/3/curl2300.out  --include --trace-ascii log/3/trace2300 --trace-time -T . ws://127.0.0.1:64854/2300 > log/3/stdout2300 2> log/3/stderr2300
=== End of file commands.log

https://github.com/curl/curl/actions/runs/19651206031/job/56278394121?pr=19675#step:13:4775

@vszakats

vszakats commented Nov 24, 2025 •

Copy link
Copy Markdown
Member Author

Torture test is showing a socket handle leak in the code we looked at
earlier due its use of strongly not recommended TerminateThread().
This new fallout seems unrelated, but suggests the solution may have
other issues too.

Ref: 9a26633 #17572 #17451

Questions:

  • how to limit the scope of the Windows torture tests to finish around ~10 minutes? (a !FTP run is <24m and flaky)
  • how to suppress these torture failures?
  • someone willing to review/fix the code causing issues: win32_stdin_read_thread()?

@bagder

bagder commented Nov 25, 2025 •

Copy link
Copy Markdown
Member

how to limit the scope of the Windows torture tests to finish around ~10 minutes? (a !FTP run is <24m and flaky)

I suppose we could reduce the --shallow a little more, but I'm a little vary that if we reduce it too much they might miss too much. The flaky part I don't know as those problems look like weird Windows-specific ones.

how to suppress these torture failures?
willing to review/fix the code

We don't have a way to suppress such as we've never had to - I don't think we can even get false positives. These two are legit errors it seems. See #19689.

@bagder

bagder commented Nov 25, 2025 •

Copy link
Copy Markdown
Member

A limitation with the torture testing is that it logs the activities to have them checked after the fact. This makes it sensitive to and mostly incompatible with threads. For non-windows we don't run the memory-tracking torture tests when using threads. We rely on valgrind then to detect leaks.

win32_stdin_read_thread that gets the problem identified uses threads.

bagder added a commit that referenced this pull request Nov 25, 2025
@vszakats

Copy link
Copy Markdown
Member Author

Yes, the flakiness is unrelated to torture itself, it just runs longer
and may have a higher chance catching a flaky breakages (I guess).

A remaining concern is the length of this test, adding 11 minutes
to the overall finish time (15.5 → 26.5), almost doubling it. I find
the 20-minute hung Windows job times already much annoying.

After rebasing on #19689, the calloc leak seems to remain, in
addition to the socket handle leak.

@bagder

bagder commented Nov 25, 2025

Copy link
Copy Markdown
Member

After rebasing on #19689, the calloc leak seems to remain, in addition to the socket handle leak.

Yeah, I first believed I had spotted an error but I was wrong. It might be a problem caused by the threading.

@bagder

bagder commented Nov 25, 2025

Copy link
Copy Markdown
Member
  • In general, I find tracking down torture tests tricky until I can reproduce them locally. I can't reproduce these windows problems.
  • The slowness
  • The flakiness
  • The threading used for stdin reading and for name resolving make this fragile

I no longer believe running Windows torture tests in CI is going to be feasible.

@vszakats

vszakats commented Nov 25, 2025 •

Copy link
Copy Markdown
Member Author

Yeah, it's a forever thread at the moment. It probably should be gracefully
terminated (in atexit?) and resources released. I admit I don't grok why all
this magic is necessary to read stdin in this case. It's causing a series of
issues.

Pushed a run to see if tweaking --shallow can give better run times and
still catch issues, or at least these ones.

shallow=5 also picks this, reaches a memlimit and there is also the error
message that was meant to be worked around by introducing the threaded
stdin thingy:

=== Start of file stderr2300
 LIMIT D:/a/curl/curl/src/tool_doswin.c:887 socket reached memlimit
 LIMIT D:/a/curl/curl/lib/getenv.c:48 realloc reached memlimit
 curl: socket error: 0
 LIMIT D:/a/curl/curl/lib/getenv.c:48 realloc reached memlimit
 Warning: win32_stdin_read_thread returned INVALID_SOCKET falling back to 
 Warning: blocking mode
 LIMIT D:/a/curl/curl/lib/getenv.c:48 realloc reached memlimit
 Warning: fcntl failed on fd=0: The access code is invalid.
 LIMIT D:/a/curl/curl/lib/urlapi.c:1280 calloc reached memlimit
 curl: (27) Out of memory
=== End of file stderr2300

shallow=20 finished in 19.5 minutes, 15, 10 and 5 took longer
and timed out. 19.5 is still slower than ideal.

https://github.com/curl/curl/actions/runs/19667198537/job/56326962912?pr=19675

I agree it's not practical as it is. Maybe if we could pinpoint tests
hitting Windows-specific code, and run just those explicitly, it may
be useful. At least we learned it runs without major or unexpected
fallouts.

@vszakats vszakats closed this Nov 25, 2025
@vszakats
vszakats deleted the wtort branch November 25, 2025 11:42
vszakats added a commit that referenced this pull request Dec 5, 2025
Test became flaky with memanalyze errors after merging #19845,
in a TrackMemory Windows Unicode c-ares openssl-quic build:
GHA/windows: mingw, AM x86_64 c-ares U.

Disable it until further investigation.

This test uses the Windows-specific multi-threaded stdin code
that caused issues in the past. It's also using `TerminateThread()`,
that apps aren't supposed to.

Examples:
#19845 (comment)
https://github.com/curl/curl/actions/runs/19948992659/job/57205061260?pr=19845#step:13:3028
https://github.com/curl/curl/actions/runs/19966429786/job/57259325027?pr=19852#step:13:3030

Also seen to fail earlier while testing torture tests on Windows:
#19675 (comment)

Ref: 4e051ff #19845

Closes #19855
vszakats added a commit that referenced this pull request Dec 7, 2025
vszakats added a commit that referenced this pull request Dec 8, 2025
With Schannel and Unicode, `-shallow=13`. It finishes in 12 minutes,
making it the slowest Windows job. It's still on par with torture jobs
on other platforms (though they manage to fit `-shallow=25`).

Also `-shallow=13` still caught leaks in multiple tests.

Also:
- test2300: exclude from CI Windows torture tests.
- experimental.

The downside of going with deeper torture tests, is that it requires
increasing the job timeout. This in turns means that a hung job takes
more minutes to be killed (due to GitHub bugs where a hung step does not
honor the per-step timeout on Windows, another bug where a hung job gets
killed +5 minutes above the workflow timeout, and another bug (or
feature?) where other failed/hung jobs in the the workflow cannot be
restarted till the last job finishes or gets killed. And all this
probably related to a Perl bug which makes it hang on fork errors, which
is turn related to Cygwin/MSYS2 runtime bugs which breaks fork in case
of curl's mixed MSYS2-Perl/native-curl-binaries environment.)
The end result in longer forced waits before being able to restart flaky
jobs, which slows down iterations and annoying.

Also tried:
- non-c-ares job: detected known issues much less often.
- replaced libidn2 with WinIDN: detected known issues much less often.
- runtests -j9-j20 values: did not make a difference.
- other `-shallow` values: 20 is the max feasible, but comes with the
  downside described above.

Ref: #19675 (reboot of)
Follow-up to f08417c #19863

Closes #19865
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous Integration Windows Windows-specific

Development

Successfully merging this pull request may close these issues.

2 participants