Skip to content
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

Fix createdump crash on alpine 3.12 and above. #56272

Merged
merged 1 commit into from
Jul 25, 2021

Conversation

mikem8361
Copy link
Member

Finally hit an existing problem in createdump (since 2.1) where the std::set in
ThreadInfo::GetThreadStack() where it is calling CrashInfo::SearchMemoryRegions with m_crashInfo.OtherMappings()
which returns a copy of the set of MemoryRegions instead of a reference. On alpine 3.12 musl, this set copy
is freed right away when it goes out of scope as soon as SearchMemoryRegions returns. On any other Linux distro
and MacOS the set doesn't get freed/invalidated as soon.

Return references to the threads and memory region sets in the CrashInfo functions.

Finally hit an existing problem in createdump (since 2.1) where the std::set<MemoryRegions> in
ThreadInfo::GetThreadStack() where it is calling CrashInfo::SearchMemoryRegions with m_crashInfo.OtherMappings()
which returns a copy of the set of MemoryRegions instead of a reference. On alpine 3.12 musl, this set copy
is freed right away when it goes out of scope as soon as SearchMemoryRegions returns. On any other Linux distro
and MacOS the set doesn't get freed/invalidated as soon.

Return references to the threads and memory region sets in the CrashInfo functions.
@ghost
Copy link

ghost commented Jul 24, 2021

Tagging subscribers to this area: @tommcdon
See info in area-owners.md if you want to be subscribed.

Issue Details

Finally hit an existing problem in createdump (since 2.1) where the std::set in
ThreadInfo::GetThreadStack() where it is calling CrashInfo::SearchMemoryRegions with m_crashInfo.OtherMappings()
which returns a copy of the set of MemoryRegions instead of a reference. On alpine 3.12 musl, this set copy
is freed right away when it goes out of scope as soon as SearchMemoryRegions returns. On any other Linux distro
and MacOS the set doesn't get freed/invalidated as soon.

Return references to the threads and memory region sets in the CrashInfo functions.

Author: mikem8361
Assignees: mikem8361
Labels:

area-Diagnostics-coreclr

Milestone: -

pClrDataProcess->QueryInterface(__uuidof(ISOSDacInterface), (void**)&pSos);

if (pClrDataProcess != nullptr) {
pClrDataProcess->QueryInterface(__uuidof(ISOSDacInterface), (void**)&pSos);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this logic should be inside the UnwindThread. We already always do a null check in there and we only use this interface in case there's an exception. This is pretty cheap, so I don't mind it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll clean that up next time.

@mikem8361 mikem8361 merged commit 9586375 into dotnet:main Jul 25, 2021
@mikem8361 mikem8361 deleted the misccreatedump branch July 25, 2021 19:13
@ghost ghost locked as resolved and limited conversation to collaborators Aug 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants