Thread overview
Re: Send never returns
Sep 30, 2010
Jonathan M Davis
Sep 30, 2010
Bob Cowdery
Oct 01, 2010
Jonathan M Davis
Oct 01, 2010
Bob Cowdery
September 30, 2010
On Thursday 30 September 2010 12:13:02 Bob Cowdery wrote:
>  Hi
> 
> I'm just starting to debug some code and have run into a problem.  There is a bit too much code to post so as a first shot I wondered if anyone has had this happen.
> 
> I have a thread in a read loop reading from a USB device. When it accumulates enough data it dispatches it to another thread. The read loop is working fine and I can see the accumulated data but when I call tid.send() it never returns. There are no errors. I have not put in exception handling yet and wondered about the default behavior when exceptions are not caught. Are they just passed up and spat out on the console? I know it's a long shot but does anyone have any ideas.
> 
> bob

There are various bugs with std.concurrency at the moment that make it so that it doesn't always work. For instance, I reported this bug on std.concurrency: http://d.puremagic.com/issues/show_bug.cgi?id=4601 It relates to threads not terminating and/or other threads not running after another thread has run. There are, I believe, other similar bugs which have been reported, though I'd have to go searching to see what they are.

Personally, I find std.concurrency totally unusable at the moment. It rarely works for me, and I just don't trust it. I really _want_ to use it, but it's just too buggy right now.

- Jonathan M Davis
September 30, 2010
 On 30/09/2010 20:58, Jonathan M Davis wrote:
> On Thursday 30 September 2010 12:13:02 Bob Cowdery wrote:
>>  Hi
>>
>> I'm just starting to debug some code and have run into a problem.  There is a bit too much code to post so as a first shot I wondered if anyone has had this happen.
>>
>> I have a thread in a read loop reading from a USB device. When it accumulates enough data it dispatches it to another thread. The read loop is working fine and I can see the accumulated data but when I call tid.send() it never returns. There are no errors. I have not put in exception handling yet and wondered about the default behavior when exceptions are not caught. Are they just passed up and spat out on the console? I know it's a long shot but does anyone have any ideas.
>>
>> bob
> There are various bugs with std.concurrency at the moment that make it so that it doesn't always work. For instance, I reported this bug on std.concurrency: http://d.puremagic.com/issues/show_bug.cgi?id=4601 It relates to threads not terminating and/or other threads not running after another thread has run. There are, I believe, other similar bugs which have been reported, though I'd have to go searching to see what they are.
>
> Personally, I find std.concurrency totally unusable at the moment. It rarely works for me, and I just don't trust it. I really _want_ to use it, but it's just too buggy right now.
>
> - Jonathan M Davis

Is this a bug?

I've tracked down this particular issue. It seems that if a thread (B)
is spawned from another thread (A) then A can message B but if B tries
to message A it never returns. However, B and C can communicate Ok. I
did have three threads, A spawning B &C. I now have just B &C with a
receive loop in the main thread which appears to work. Everyone can
message everyone else.

I can't do this app without threads and I really want to use message
passing concurrency. If it's really unreliable that's going to be a stopper.

bob


October 01, 2010
On Thursday 30 September 2010 14:21:24 Bob Cowdery wrote:
> Is this a bug?
> 
> I've tracked down this particular issue. It seems that if a thread (B) is spawned from another thread (A) then A can message B but if B tries to message A it never returns. However, B and C can communicate Ok. I did have three threads, A spawning B &C. I now have just B &C with a receive loop in the main thread which appears to work. Everyone can message everyone else.
> 
> I can't do this app without threads and I really want to use message passing concurrency. If it's really unreliable that's going to be a stopper.
> 
> bob

I really don't know what exactly works and what doesn't with std.concurrency. You'll have to mess around with it to see if you can get it to do what you want, but I've given up on it for the time being. Some people are definitely using it in code, but I don't know what they're doing with it and why it works (or seems to work) when whatever I've tried to use it for has run into problems like the bug I mentioned before.

- Jonathan M Davis
October 01, 2010
 On 01/10/2010 02:42, Jonathan M Davis wrote:
> On Thursday 30 September 2010 14:21:24 Bob Cowdery wrote:
>> Is this a bug?
>>
>> I've tracked down this particular issue. It seems that if a thread (B) is spawned from another thread (A) then A can message B but if B tries to message A it never returns. However, B and C can communicate Ok. I did have three threads, A spawning B &C. I now have just B &C with a receive loop in the main thread which appears to work. Everyone can message everyone else.
>>
>> I can't do this app without threads and I really want to use message passing concurrency. If it's really unreliable that's going to be a stopper.
>>
>> bob
> I really don't know what exactly works and what doesn't with std.concurrency. You'll have to mess around with it to see if you can get it to do what you want, but I've given up on it for the time being. Some people are definitely using it in code, but I don't know what they're doing with it and why it works (or seems to work) when whatever I've tried to use it for has run into problems like the bug I mentioned before.
>
> - Jonathan M Davis
There is definitely something not right with the error handling. Certain errors will stop a thread dead with no exception thrown. I've just been debugging one such thread and found I was calculating a very large out of bounds offset for an array. When I fixed that I had another mistake where the source and destination slice was not equal. In this case it threw an exception.

bob