* mono-threads-posix.c: If we get the suspend signal while the thread
is detaching, we end up with a non null thread info but a null jit info.
This leads to thread_state_init_from_sigctx returning false. The
solution on this case is not to crash, but to tell the suspender
that the current suspend attempt failed.
Fixes an intermittent crash on the linux bots.
ret = mono_threads_get_runtime_callbacks ()->thread_state_init_from_sigctx (¤t->suspend_state, context);
- g_assert (ret);
+ /* thread_state_init_from_sigctx return FALSE if the current thread is detaching and suspend can't continue. */
+ current->suspend_can_continue = ret;
MONO_SEM_POST (¤t->suspend_semaphore);
-
+
+ /* This thread is doomed, all we can do is give up and let the suspender recover. */
+ if (!ret)
+ return;
+
while (MONO_SEM_WAIT (¤t->resume_semaphore) != 0) {
/*if (EINTR != errno) ABORT("sem_wait failed"); */
}
while (MONO_SEM_WAIT (&info->suspend_semaphore) != 0) {
/* g_assert (errno == EINTR); */
}
- return TRUE;
+ return info->suspend_can_continue;
}
gboolean
#if (defined(_POSIX_VERSION) || defined(__native_client__)) && !defined (__MACH__)
MonoSemType suspend_semaphore;
gboolean syscall_break_signal;
+ gboolean suspend_can_continue;
#endif
/*In theory, only the posix backend needs this, but having it on mach/win32 simplifies things a lot.*/