Debugging silent exit of threads in Phobos calls

ketmar ketmar at ketmar.no-ip.org
Fri Jun 1 13:37:52 UTC 2018


Steven Schveighoffer wrote:

> On 6/1/18 7:12 AM, Russel Winder wrote:
>> So I had a play and gdb seems to be useless for trying to find out why
>> calls to std.concurrency.receive exit silently.
>> Obviously std.concurrency.receive should never terminate a thread, and
>> it should never terminate a thread silently, but given that it clearly
>> does (using dmd 2.080 from d-apt on Debian Sid) how is one to find out
>> useful information as to why it is exiting silently.
>
> I remember something like a receive thread that throws terminates 
> silently. Do a try/catch to see if it's that.
>
> -Steve

yeah. if it receives something it doesn't expect (and there is no `Variant` 
clause to catch it), it throws. and exceptions from threads are silently 
dropped on the floor -- along with the dead threads. so it is better to 
always wrap your threads in `try/catch`, and at least log an exception.


More information about the Digitalmars-d-learn mailing list