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

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mono/metadata/icall.c
Original file line number Diff line number Diff line change
Expand Up @@ -6104,7 +6104,8 @@ ves_icall_Mono_Runtime_EnableMicrosoftTelemetry (const char *appBundleID, const
#if defined(TARGET_OSX) && !defined(DISABLE_CRASH_REPORTING)
mono_merp_enable (appBundleID, appSignature, appVersion, merpGUIPath, eventType, appPath, configDir);

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.

#else
// Icall has platform check in managed too.
g_assert_not_reached ();
Expand Down
9 changes: 8 additions & 1 deletion mono/metadata/threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -6619,7 +6619,14 @@ mono_threads_summarize_execute_internal (MonoContext *ctx, gchar **out, MonoStac
gboolean
mono_threads_summarize_execute (MonoContext *ctx, gchar **out, MonoStackHash *hashes, gboolean silent, gchar *working_mem, size_t provided_size)
{
return mono_threads_summarize_execute_internal (ctx, out, hashes, silent, working_mem, provided_size, FALSE);
gboolean result;
gboolean already_async = mono_thread_info_is_async_context ();
if (!already_async)
mono_thread_info_set_is_async_context (TRUE);
result = mono_threads_summarize_execute_internal (ctx, out, hashes, silent, working_mem, provided_size, FALSE);
if (!already_async)
mono_thread_info_set_is_async_context (FALSE);
return result;
}

gboolean
Expand Down
6 changes: 4 additions & 2 deletions mono/mini/mini-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1003,11 +1003,13 @@ dump_native_stacktrace (const char *signal, MonoContext *mctx)
dump_for_merp = mono_merp_enabled ();
#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)

#endif

if (!dump_for_merp) {
#ifdef DISABLE_STRUCTURED_CRASH
leave = TRUE;
#else
mini_register_sigterm_handler ();
#endif
}

Expand Down