New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmake: disable unity mode with Windows Unicode + TrackMemory #12005
Closed
Conversation
This file contains 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
"TrackMemory" is `ENABLE_DEBUG=ON` (aka `ENABLE_CURLDEBUG=ON`, aka `-DCURLDEBUG`). There is an issue with memory tracking and Unicode when build in "unity" mode, which results in the curl tool crashing right on startup, even without any command-line option. Interestingly this doesn't happen under WINE (at least on the system I tested this on), but consistenly happens on real Windows machines. Crash is 0xC0000374 heap corruption. Both shared and static curl executables are affected. This limitation probably won't hit too many people, but it remains a TODO to find and fix the root cause and drop this workaround. Example builds and runs: https://ci.appveyor.com/project/curlorg/curl/builds/48169111/job/17cptxhtpubd7iwj#L313 (static) https://ci.appveyor.com/project/curlorg/curl/builds/48169111/job/76e1ge758tbyqu9c#L317 (shared) Follow-up to 3f8fc25 curl#11095 Ref curl#11928 Closes #xxxxx
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Oct 3, 2023
Found the root cause of the startup crash with unity builds with Unicode and TrackMemory enabled at the same time. We must make sure that the `memdebug.h` header doesn't apply to `lib/curl_multibyte.c` (as even noted in a comment there.). In unity builds all headers apply to all sources, including `curl_multibyte.c`. This probably resulted in an infinite loop on startup. This patch excludes this source from unity compilation with TrackMemory enabled, in both libcurl and curl tool. Also delete the earlier workaround that fully disabled unity for affected builds. Also enable unity mode for a debug unicode CI job. Follow-up to d82b080 curl#12005 Closes curl#11928
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Oct 3, 2023
Found the root cause of the startup crash with unity builds with Unicode and TrackMemory enabled at the same time. We must make sure that the `memdebug.h` header doesn't apply to `lib/curl_multibyte.c` (as even noted in a comment there.). In unity builds all headers apply to all sources, including `curl_multibyte.c`. This probably resulted in an infinite loop on startup. This patch excludes this source from unity compilation with TrackMemory enabled, in both libcurl and curl tool. Also delete the earlier workaround that fully disabled unity for affected builds. Also enable unity mode for a debug unicode CI job. Follow-up to d82b080 curl#12005 Follow-up to 3f8fc25 curl#11095 Closes curl#11928
vszakats
added a commit
that referenced
this pull request
Oct 3, 2023
Found the root cause of the startup crash in unity builds with Unicode and TrackMemory enabled at the same time. We must make sure that the `memdebug.h` header doesn't apply to `lib/curl_multibyte.c` (as even noted in a comment there.) In unity builds all headers apply to all sources, including `curl_multibyte.c`. This probably resulted in an infinite loop on startup. Exclude this source from unity compilation with TrackMemory enabled, in both libcurl and curl tool. Enable unity mode for a debug Unicode CI job to keep it tested. Also delete the earlier workaround that fully disabled unity for affected builds. Follow-up to d82b080 #12005 Follow-up to 3f8fc25 #11095 Closes #11928
zuoxiaofeng
pushed a commit
to zuoxiaofeng/curl
that referenced
this pull request
Nov 28, 2023
"TrackMemory" is `ENABLE_DEBUG=ON` (aka `ENABLE_CURLDEBUG=ON`, aka `-DCURLDEBUG`). There is an issue with memory tracking and Unicode when built in "unity" mode, which results in the curl tool crashing right on startup, even without any command-line option. Interestingly this doesn't happen under WINE (at least on the system I tested this on), but consistenly happens on real Windows machines. Crash is 0xC0000374 heap corruption. Both shared and static curl executables are affected. This limitation probably won't hit too many people, but it remains a TODO to find and fix the root cause and drop this workaround. Example builds and runs: https://ci.appveyor.com/project/curlorg/curl/builds/48169111/job/17cptxhtpubd7iwj#L313 (static) https://ci.appveyor.com/project/curlorg/curl/builds/48169111/job/76e1ge758tbyqu9c#L317 (shared) Follow-up to 3f8fc25 curl#11095 Ref: curl#11928 Closes curl#12005
zuoxiaofeng
pushed a commit
to zuoxiaofeng/curl
that referenced
this pull request
Nov 28, 2023
Found the root cause of the startup crash in unity builds with Unicode and TrackMemory enabled at the same time. We must make sure that the `memdebug.h` header doesn't apply to `lib/curl_multibyte.c` (as even noted in a comment there.) In unity builds all headers apply to all sources, including `curl_multibyte.c`. This probably resulted in an infinite loop on startup. Exclude this source from unity compilation with TrackMemory enabled, in both libcurl and curl tool. Enable unity mode for a debug Unicode CI job to keep it tested. Also delete the earlier workaround that fully disabled unity for affected builds. Follow-up to d82b080 curl#12005 Follow-up to 3f8fc25 curl#11095 Closes curl#11928
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.
"TrackMemory" is
ENABLE_DEBUG=ON
(akaENABLE_CURLDEBUG=ON
,aka
-DCURLDEBUG
).There is an issue with memory tracking and Unicode when built in "unity"
mode, which results in the curl tool crashing right on startup, even
without any command-line option. Interestingly this doesn't happen under
WINE (at least on the system I tested this on), but consistenly happens
on real Windows machines. Crash is 0xC0000374 heap corruption. Both
shared and static curl executables are affected.
This limitation probably won't hit too many people, but it remains
a TODO to find and fix the root cause and drop this workaround.
Example builds and runs:
https://ci.appveyor.com/project/curlorg/curl/builds/48169111/job/17cptxhtpubd7iwj#L313 (static)
https://ci.appveyor.com/project/curlorg/curl/builds/48169111/job/76e1ge758tbyqu9c#L317 (shared)
Follow-up to 3f8fc25 #11095
Ref: #11928
Closes #12005