Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lambdageek
Copy link
Member

@lambdageek lambdageek commented Oct 11, 2019

install_state_summarizer installs a SIGTERM handler. Unfortunately sigterm_signal_handler assumes that it will only be called when a crash is already in progress (it assumes it won't be the supervisor, and so it doesn't setup the memory for capturing a crash report among other things).

Addresses #17271

monojenkins and others added 2 commits October 11, 2019 15:50
[merp] Put thread into async context before running summarizer

Followup work for mono#17090

In order to get managed method info for unmanaged stacktraces, we call
`mini_jit_info_table_find_ext` which calls `decode_exception_debug_info` which may
allocate if it's not in async context.

Do the switch in `mono_threads_summarize_execute` so that non-supervising threads
all switch when they run the `sigterm_signal_handler`.  `mono_threads_summarize`
already does it for the supervisor thread.

Fixes mono#17180

Backport of mono#17194.

/cc @lambdageek
install_state_summarizer installs a SIGTERM handler. Unfortunately
sigterm_signal_handler assumes that it will only be called when a crash is
already in progress (it assumes it won't be the supervisor, and so it doesn't
setup the memory for capturing a crash report among other things).
@lambdageek lambdageek added Work In Progress PR not ready for review yet do-not-merge labels Oct 11, 2019
@lambdageek
Copy link
Member Author

@monojenkins build pkg

@lambdageek lambdageek changed the title DRAFT: Don't install SIGTERM handler in EnableMicrosoftTelemetry [merp] Don't install SIGTERM handler in EnableMicrosoftTelemetry Oct 11, 2019
@lambdageek lambdageek changed the title [merp] Don't install SIGTERM handler in EnableMicrosoftTelemetry [2019-06][merp] Don't install SIGTERM handler in EnableMicrosoftTelemetry Oct 11, 2019
@lambdageek lambdageek removed Work In Progress PR not ready for review yet do-not-merge labels Oct 11, 2019
@lambdageek
Copy link
Member Author

lambdageek commented Oct 11, 2019

Verified that kill -TERM <pid> and Force Quit both just exit VSfM without starting a crash reporting session (or hitting the assertion from #17271 )

@lambdageek lambdageek added this to the 2019-06 (6.4.xx) milestone Oct 11, 2019
@lambdageek lambdageek marked this pull request as ready for review October 11, 2019 23:14
@lambdageek
Copy link
Member Author

@monojenkins build failed

Previously it was installed by EnableMicrosoftTelemetry, which is too early.
Now we get here without a handler installed even when mono_merp_enabled returns true.
@lambdageek lambdageek requested a review from lewurm as a code owner October 11, 2019 23:28
@lambdageek
Copy link
Member Author

@monojenkins build pkg


mono_get_runtime_callbacks ()->install_state_summarizer ();
// Why does this install the sigterm handler so early?
// mono_get_runtime_callbacks ()->install_state_summarizer ();
Copy link
Contributor

Choose a reason for hiding this comment

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

To avoid race conditions of installing the handler on multiple concurrent crashing threads?
To avoid the heap allocations in the crashing path (see the signal chaining)?

Copy link
Contributor

@jaykrell jaykrell Oct 12, 2019

Choose a reason for hiding this comment

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

Suggest, perhaps, install the handler at the same time, but use a boolean to enable/disable it.
I'm just guessing.

#endif

#ifndef DISABLE_STRUCTURED_CRASH
mini_register_sigterm_handler ();
Copy link
Contributor

@alexischr alexischr Oct 12, 2019

Choose a reason for hiding this comment

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

This should probably just be in the !leave block, otherwise we install a bit eagerly, even when !dump_for_merp or when DISABLE_STRUCTURED_CRASH is defined

Copy link
Member Author

Choose a reason for hiding this comment

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

Don't we want to install it if !dump_for_merp when DISABLE_STRUCTURED_CRASH is undefined? I thought that combination meant that we're going to dump a json file, but not upload to merp (in theory that's what CI should be doing)

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I was misreading the !(dump_for_merp) block (the leave=true is still under a #ifdef)

@marek-safar
Copy link
Member

@monojenkins build failed

@lambdageek
Copy link
Member Author

@monojenkins backport to 2019-08
@monojenkins backport to 2019-06

@lambdageek
Copy link
Member Author

@monojenkins backport to 2019-10
@monojenkins backport to master

@marek-safar marek-safar merged commit bdc5576 into mono:2019-06 Oct 14, 2019
lambdageek added a commit to lambdageek/mono that referenced this pull request Oct 28, 2019
Partly revert mono#17296 backports.

Follow-up work for backports of mono#17537 backports.

Addresses mono#17419
monojenkins pushed a commit to monojenkins/mono that referenced this pull request Oct 28, 2019
Partly revert mono#17296 backports.

Follow-up work for backports of mono#17537 backports.

Addresses mono#17419
alexischr pushed a commit that referenced this pull request Oct 28, 2019
Partly revert #17296 backports.

Follow-up work for backports of #17537 backports.

Addresses #17419
alexischr pushed a commit that referenced this pull request Oct 28, 2019
Partly revert #17296 backports.

Follow-up work for backports of #17537 backports.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants