Repository navigation
Conversation
runtests offers an option to use an external curl for making API requests to CI servers. Such requests are made by default when running on AppVeyor CI or Azure CI. Depending on CI machine version, configuration, such external curl may have the TrackMemory feature enabled. Such curl picks up the `CURL_MEMDEBUG` env set by runtests and meant for the test binaries it's testing. Yet, before this patch this env was also passed to the external curl. This causes a TrackMemory-enabled external curl to log its own memory trace events into the tests', corrupting it and making tests fail with weird errors, in a consistently flaky fashion. Example fails: ``` ** MEMORY FAILURE Not recognized prefix line: SEND sendf.c:391 send(424) = 424 Not recognized prefix line: RECV sendf.c:459 recv(102400) = 114 3216: memory FAILED [...] test 3306 [thrdqueue retries failed thread starts on receive] ** MEMORY FAILURE Not recognized prefix line: il)) [...] test 1607 [CURLOPT_RESOLVE parsing] ** MEMORY FAILURE Not recognized prefix line: 47 calloc(2,8) = 0xde7a13368 CUSTOMBUILD : FREE error : No memory allocated: MEM C:/projects/curl/lib/url.c:303 free(0xde7a145b8) CUSTOMBUILD : FREE error : No memory allocated: MEM C:/projects/curl/lib/url.c:3 ``` Notice, current curl no longer emits SEND/RECV log events. The line numbers match the source code of curl 7.65.3. The other two examples are foreign / corrupt log lines. To fix, make sure to unset this env before calling the external curl, avoiding this issue with all curl builds. It's easier to avoid this by using a correctly built curl, once one knows what's the problem. Figuring this out took 3 days of head-scratching (combined with a whole bunch of other issues). I figure if it may save this for someone else, it's worth fixing the root cause. Bug: curl#23306 (comment) Bug: curl#23306 (comment) Bug: curl#23306 (comment) Bug: curl#23306 (comment) Cherry-picked from curl#23306
There was a problem hiding this comment.
🟢 Approval recommended
The scoped environment changes cover the external CI curl calls without permanently changing the test runner’s environment.
0 open findings
What changed in this PR
This PR prevents external curl calls made by the test runner’s CI integrations from writing memory traces into test logs.
Changes:
- Temporarily unset
CURL_MEMDEBUGfor Azure and AppVeyor API requests. - Restore the test runner’s environment after each call.
| File | Description |
|---|---|
tests/azure.pm |
Unsets CURL_MEMDEBUG around Azure API calls. |
tests/appveyor.pm |
Unsets CURL_MEMDEBUG around AppVeyor API calls. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
CURL_MEMDEBUG for external curl invocationsCURL_MEMDEBUG for API request curl invocations
CURL_MEMDEBUG for API request curl invocationsCURL_MEMDEBUG for CI API curl requests
CURL_MEMDEBUG for CI API curl requestsCURL_MEMDEBUG for curl requests made to the CI API
1 task done
9 of 10 tasks
vszakats
added a commit
that referenced
this pull request
Oct 18, 2026
- in jobs building tests, also run them. - to maintain CI cycle times, only run unit tests by default, and run all (supported) tests in just one job, carefully selected to be the one running them the fastest. Per job, it takes ~15 seconds to run ~80 unit tests. It takes 5 minutes to run all (~1600) tests. Total job time 5.5-6 minutes. If the full test run turns out to be annoying or grow slow, we disable or limit it to a subset of tests. - run tests with `-j10` parallelism. It results in the fastest runs, based on tests. - to avoid the MSBuild test breaker heuristics, and to improve performance, run tests by directly invoking `runtests.pl` (not via CMake -> MSBuild -> `runtests.pl`). It saves 10-40 seconds per full test run. - when running directly via `runtests.pl`, exclude test 1119 and 1167. It's not compatible with Visual Studio generator builds. - run the artifact upload in parallel with running tests. Running Windows tests in multiple environments makes it more likely they can run on local machines, too, also making them easier to debug. AppVeyor also supports remote access via RDP, which may help debugging notorious Windows issues live, with some luck of reproducing it in a run with RDP access explicitly enabled beforehand. Fixes/improvements via this PR, merged separately: dc99e12 #23467 processhelp.pm: improve task info in trace output (Windows) 70f3f85 #23471 test1488: drop unused C preprocessor logic af9d2dd #23336 cmake: fix preconditions for option `CURL_STATIC_CRT=ON` adf8b78 #23428 setopt: fix setting `CURLWS_NOAUTOPONG` with compilers lacking C99 bool type 780405b #23416 tests: add `--dump-module-paths` debug option (Windows) bc22977 #23400 msvc: replace debug CRT GUI popups with stderr output 87a1dc7 #23396 appveyor: minor improvements 67f3510 #23381 runtests: add `-S` option to show success logs e9af987 #23378 tests/server: fix crashing with VS2013 and earlier 8cdee8a #23377 lib557: exclude three floating point test cases for VS2013 and earlier 1aac64a #23375 test1119, 1167: disable MSYS2 argument conversion narrowly 49f003f #23337 unit1664: add workaround for VS2019 16.3 - VS2022 17.4 x64 miscompile b8f71d6 #23345 test428: skip when running on older MSYS2 versions 2f3f99d #23339 test1119, 1167: disable MSYS2 argument conversion 098d3a0 #23332 runtests: unset `CURL_MEMDEBUG` for curl requests made to the CI API d3e7caf #23335 GHA/windows: drop unused `-ac` runtests options 2874cc6 #23317 mqttd: work around bogus VS2019 32-bit compiler warning e8adc72 #23315 schannel: fix guard for old MSVC workaround Follow-up to 41198e0 #20390 Closes #23306
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
runtests has an automatic feature which detects AppVeyor and Azure CI,
and communicates runtests test progress and results through the CI API.
This feature uses the curl tool to send the API requests. It offers the
-acTFLAGS option to configure an external curl tool for theserequests, otherwise it uses the freshly built curl tool.
This curl is invoked from the same environment used to invoke the actual
test curl commands and unit test binaries, thus it has
CURL_MEMDEBUGset and pointing to a test-specific log file.
The issue arises when the curl tool making the API request happens to be
a debug-enabled one, with the 'TrackMemory' feature enabled. Such curl
picks up the
CURL_MEMDEBUGenv and dumps it's own, memory tracingoutput into the test's log file. This causes flaky but consistent test
failures, with bizarre errors, reporting corrupt or unsupported lines,
and/or just not matching the expected output.
When relying on the freshly built curl (without the
-acoption) thisis guaranteed to happen for all debug-enabled builds. As I found out the
hard way, AppVeyer CI Windows 2012/2016 machines come preinstalled with
an MSYS2 curl, which has TrackMemory enabled, which was explicitly set
to fix this issue, and caused the very same problem.
To fix, ensure to unset
CURL_MEMDEBUGbefore making the API requestwith curl, avoiding this issue with all curl builds. It fixes future
suprises, and also makes the freshly built curl a viable option in most
cases, even in debug-enabled builds. (the requirement is to have
working, cleartext HTTP support; for the AppVeyor API.)
Example fails:
Notice, current curl no longer emits SEND/RECV log events. The line
numbers match the source code of curl 7.65.3. The other two examples
are foreign / corrupt log lines.
The TrackMemory-enabled curl was shipping in MSYS2, and come
preinstalled on these AppVeyor CI machine, as
C:\msys64\usr\bin\curl.exe:Bug: #23306 (comment)
Bug: #23306 (comment)
Bug: #23306 (comment)
Bug: #23306 (comment)
Cherry-picked from #23306
-acoption anda debug-enabled curl build? Maybe update PR message accordingly.
Yes, same issue: https://ci.appveyor.com/project/curlorg/curl/builds/54867746