ASSERT on detach: core/unix/os.c:9825 thread_takeover_records != NULL
Running an app that runs some code snippets under native_exec:
<Starting application myapp>
<Attached to 5 threads in application myapp>
<entered at least one module natively>
<returned from at least one native module>
<Detaching from application myapp>
<Application myapp. Internal Error: DynamoRIO debug check failure: core/unix/os.c:9825 thread_takeover_records != NULL
Looks like it's this code at the top of master_signal_handler_C:
} else if (sig == SUSPEND_SIGNAL && dcontext == NULL) {
/* We sent SUSPEND_SIGNAL to a thread we don't control (no
* dcontext), which means we want to take over.
*/
sig_take_over(ucxt); /* no return */
ASSERT_NOT_REACHED();
If we put "!doing_detach" there we'll just hit the exit bailout at the end, though.
There is code in detach_on_permanent_stack() to handle native threads, but it assumes we can suspend them. #2089 (closed)'s big change to have no dcontext while temporarily native is the problem: it never updated native thread handling during a synch such as detach.