Thread overview
[Issue 21686] segfault if daemon thread is killed, interrupts syscall and throws exception
Mar 07, 2021
Tobias Pankrath
Mar 07, 2021
Adam D. Ruppe
Mar 07, 2021
kinke
Dec 17, 2022
Iain Buclaw
Dec 17, 2022
Iain Buclaw
March 07, 2021
https://issues.dlang.org/show_bug.cgi?id=21686

--- Comment #1 from Tobias Pankrath <tobias@pankrath.net> ---
adr says:
so what i suspect it is doing is when the main function returns, druntime tries
to do a final garbage collection sweep. part o tht GC sweep is sending SIGUSR1
to interrupt all threads
[4:46 PM]
the syscall then EINTRs. the thread is then put on hold until the GC is done.

then it might be a race condition on the thread resuming and throwing the
exception and the other thread deinitializing druntime
[4:46 PM]
just a guess but an educated guess at least

--
March 07, 2021
https://issues.dlang.org/show_bug.cgi?id=21686

Adam D. Ruppe <destructionator@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |destructionator@gmail.com

--- Comment #2 from Adam D. Ruppe <destructionator@gmail.com> ---
So you don't even need the throw to trigger the problem.

void worker()
{
    timespec s = timespec(time_t(10), 0);
    nanosleep(&s, null);
    asm { int 3; }
}

will random debug trap (the int 3 getting run), terminate cleanly (the thread
must be stopped by the main thing), or segfault.

--
March 07, 2021
https://issues.dlang.org/show_bug.cgi?id=21686

kinke <kinke@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kinke@gmx.net

--- Comment #3 from kinke <kinke@gmx.net> ---
Might be a duplicate of https://issues.dlang.org/show_bug.cgi?id=19978.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=21686

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=21686

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P4                          |P2
           Severity|enhancement                 |major

--