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

Add env var to control createdump on MacOS #39982

Merged
merged 2 commits into from
Jul 29, 2020

Conversation

mikem8361
Copy link
Member

The COMPlus_DbgEnableElfDumpOnMacOS needs to be set to 1 along with all the other standard createdump env vars for dumps to be enabled on MacOS.

This is because ELF coredumps are generated on MacOS and we want customers to be very explicit and aware of what the are getting.

Change test harness to use the new env var

@ghost
Copy link

ghost commented Jul 28, 2020

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

@mikem8361
Copy link
Member Author

mikem8361 commented Jul 28, 2020 via email

@mikem8361
Copy link
Member Author

Can someone approve of this PR? I think have addressed all the code review feedback.

The COMPlus_DbgEnableElfDumpOnMacOS needs to be set to 1 along with all the other standard createdump env vars for dumps to be enabled on MacOS.

This is because ELF coredumps are generated on MacOS and we want customers to be very explicit and aware of what the are getting.

Change test harness to use the new env var
@danmoseley
Copy link
Member

Aside @mikem8361 -- couple questions (not blocking this PR of course)

In the vstest scenario, I assume vstest triggers dotnet dump collect? I'm a little unclear how that works given the process crashed - does it stay in a lingering state such that vstest can grab the dump?

Assuming so, how will native dump collection will work in test runs on macOS? You mentioned that this dump is only useful for analyzing managed failures using dotnet dump and SOS. Should dotnet dump trigger both kinds of dump - or will the OS collect a native dump?

cc @nohwnd

@mikem8361
Copy link
Member Author

For crash/unhandled exception triggered dump generation, vstest just sets the configuration environment variables before running the test (including this new one for MacOS) and the runtime exec's createdump to generate the coredump. The runtime waits until createdump is finished and then terminates like it would if the env vars weren't set. For this scenario, dotnet-dump collect isn't involved or used.

For hang/timeout triggered dump generation, vstest is more explicit and uses the Microsoft.Diagnostics.NETCore.Client write dump API (the same one that dotnet-dump collect does) to tell (via the diagnostic server IPC channel) the runtime to trigger dump generation. This exec's createdump and waits until it finished but the runtime process continues running normally.

Yes, MacOS dumps generated by either of the above can only be analyzed by dotnet-dump analyze and only provided managed state with the SOS commands. For the native state, a MacOS system could be configured (with ulimit) for crash trigger and maybe a SIGABRT signal could be sent to trigger a hang/timeout dump but that terminates the process. @josalem has already ran into the native state limitations in the createdump generated ones and has some experience with our runtime test harness's hang/timeout dump generation with SIGABRT. I'm not sure vstest can or should configure/set up the system dumps.

Copy link
Member

@noahfalk noahfalk left a comment

Choose a reason for hiding this comment

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

LGTM

@mikem8361 mikem8361 merged commit 9dc8384 into dotnet:master Jul 29, 2020
@mikem8361 mikem8361 deleted the macosenvvar branch July 29, 2020 20:56
@danmoseley
Copy link
Member

@mikem8361 thank you that is valuable clarification.

@danmoseley
Copy link
Member

For hang/timeout triggered dump generation, vstest is more explicit and uses the Microsoft.Diagnostics.NETCore.Client write dump API >

Just checking my assumption -- with this PR also such dumps are now enabled for this mechanism as well (ie for hangs on macOS not just crashes)? It's just the triggering mechanism that's different, this scenario is now complete, is that right?

@mikem8361
Copy link
Member Author

vstest will have to set this env var before launching any tests for createdump to work on MacOS regardless of how it is triggered.

FYI, @nohwnd

mikem8361 added a commit to mikem8361/runtime that referenced this pull request Jul 29, 2020
Add env var to control createdump on MacOS

The COMPlus_DbgEnableElfDumpOnMacOS needs to be set to 1 along with all the other standard createdump env vars for dumps to be enabled on MacOS.

This is because ELF coredumps are generated on MacOS and we want customers to be very explicit and aware of what the are getting.

Change test harness to use the new env var

Createdump documentation update
@danmoseley
Copy link
Member

@nohwnd I guess you're unblocked to add the env var now? I saw microsoft/vstest#2495 but it doesn't set it there.

mikem8361 added a commit that referenced this pull request Jul 30, 2020
Add env var to control createdump on MacOS

The COMPlus_DbgEnableElfDumpOnMacOS needs to be set to 1 along with all the other standard createdump env vars for dumps to be enabled on MacOS.

This is because ELF coredumps are generated on MacOS and we want customers to be very explicit and aware of what the are getting.

Change test harness to use the new env var

Createdump documentation update
Jacksondr5 pushed a commit to Jacksondr5/runtime that referenced this pull request Aug 10, 2020
Add env var to control createdump on MacOS

The COMPlus_DbgEnableElfDumpOnMacOS needs to be set to 1 along with all the other standard createdump env vars for dumps to be enabled on MacOS.

This is because ELF coredumps are generated on MacOS and we want customers to be very explicit and aware of what the are getting.

Change test harness to use the new env var

Createdump documentation update
@karelz karelz added this to the 5.0.0 milestone Aug 18, 2020
@nohwnd
Copy link
Member

nohwnd commented Aug 24, 2020

Missed these notifications, the env var is set correctly in vstest, and what Mike described above is how it is actually done.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
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.

8 participants