Thread overview
[Issue 10364] Mac OS 10.8 program crash
Jul 21, 2017
Vladimir Panteleev
Jul 21, 2017
Jacob Carlborg
Jul 21, 2017
Vladimir Panteleev
Jan 16, 2020
Mathias LANG
July 21, 2017
https://issues.dlang.org/show_bug.cgi?id=10364

Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|dmd                         |druntime

--- Comment #7 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
I reproduced it with macOS 10.12 and DMD 2.074.

Changing daemon(0,0) to daemon(0,1) (so that stderr isn't redirected to
/dev/null) reveals a clue:

core.thread.ThreadError@src/core/thread.d(3002): Unable to load thread state

It looks like the daemon() call is interfering with Druntime's threading code.

--
July 21, 2017
https://issues.dlang.org/show_bug.cgi?id=10364

--- Comment #8 from Jacob Carlborg <doob@me.com> ---
(In reply to Vladimir Panteleev from comment #7)
> I reproduced it with macOS 10.12 and DMD 2.074.
> 
> Changing daemon(0,0) to daemon(0,1) (so that stderr isn't redirected to
> /dev/null) reveals a clue:
> 
> core.thread.ThreadError@src/core/thread.d(3002): Unable to load thread state
> 
> It looks like the daemon() call is interfering with Druntime's threading
> code.

I did some more debugging. The error returned by "thread_get_state" is 268435459 (0x10000003) which seems to correspond to MACH_SEND_INVALID_DEST. This bug had the same error code [1]

[1] https://issues.dlang.org/show_bug.cgi?id=6135

--
July 21, 2017
https://issues.dlang.org/show_bug.cgi?id=10364

--- Comment #9 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
(In reply to Jacob Carlborg from comment #8)
> I did some more debugging. The error returned by "thread_get_state" is 268435459 (0x10000003) which seems to correspond to MACH_SEND_INVALID_DEST.

Interesting. daemon() calls fork(), and forked processes go on without the other threads from their parent process. It could be that something in Druntime has created a thread, which is now gone after the fork; or, possibly, that the thread ID of the main thread has changed, and Druntime is unable to correctly address it. I'm not familiar with Mach threading, though, so I can only guess.

--
January 16, 2020
https://issues.dlang.org/show_bug.cgi?id=10364

Mathias LANG <pro.mathias.lang@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pro.mathias.lang@gmail.com

--- Comment #10 from Mathias LANG <pro.mathias.lang@gmail.com> ---
I cannot reproduce the issue anymore (Mac OSX 10.15.2, DMD 2.090.0). Is it
still present ?

--