Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kyte <alexmkyte@gmail.com>2018-05-24 19:38:14 +0300
committerLudovic Henry <luhenry@microsoft.com>2018-05-24 19:38:14 +0300
commit58637d0ee7c4848210eb6c2df49ee4f35b70f7ab (patch)
treed6eb79dd5c8f05e745d4777a2a0dfd20b902c2e8
parentc22f532871c364fac35bd810d23e253b43540acf (diff)
[runtime] Gracefully handle crashes before mono-state dependencies initialized (#8842)mono-5.12.0.260
-rw-r--r--mono/metadata/threads.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/mono/metadata/threads.c b/mono/metadata/threads.c
index 86d6c5d7308..e7c1abe89c0 100644
--- a/mono/metadata/threads.c
+++ b/mono/metadata/threads.c
@@ -3638,6 +3638,10 @@ collect_threads (MonoInternalThread **thread_array, int max_threads)
{
CollectThreadsUserData ud;
+ mono_memory_barrier ();
+ if (!threads)
+ return 0;
+
memset (&ud, 0, sizeof (ud));
/* This array contains refs, but its on the stack, so its ok */
ud.threads = thread_array;
@@ -5618,6 +5622,9 @@ mono_threads_summarize (MonoContext *ctx, gchar **out)
MonoInternalThread *thread_array [128];
int nthreads = collect_threads (thread_array, 128);
+ if (nthreads == 0)
+ MOSTLY_ASYNC_SAFE_PRINTF("No managed threads detected, error occured before thread init\n");
+
sigset_t sigset, old_sigset;
sigemptyset(&sigset);
sigaddset(&sigset, SIGTERM);