Thread overview
Re: First big PITA in reallife D project
Oct 19, 2010
Fawzi Mohamed
Oct 19, 2010
Walter Bright
Oct 20, 2010
Fawzi Mohamed
October 19, 2010
On Tue, 19 Oct 2010 12:45:28 +0200, Stephan wrote:

> Hey guys I wanted to discuss my first major depressing experience with D in a reallife project.
> 
> First off here is the according bug report : http://d.puremagic.com/issues/show_bug.cgi?id=4951
> 
> I have to mention that it was by far not the first bug i encountered in D but it has never been such a PITA. I spent hours and hours of searching, rewriting and crawling my code for the cause of this issue. Just to finally find out that it was not my code but some bug in druntime.
> 
> What i do:
> I spawn multiple threads all periodically connecting to some webservers
> waiting for the request to finish. Every request is totally independent
> of the others. There is no data sharing in my code. Now i have a
> protocol that makes my process send one last important request when
> shutting down. For a clean shut down i wanted to make sure that all the
> other threads are shut down first. That way the final request of the
> process is the very last. So i wait for every thread to finish their
> request and stop them.
> BUT it wont work like that. AFTER i stopped all other threads some
> strange behavior of druntime makes every creation of an InternetAddress
> instance (internally trying to resolve host) impossible (throws an
> exception). Additionally even if the Internet Addresses were created
> upfront the TcpSockets wont connect but throw. I have no idea what the
> heck is going on inside of the druntime that could cause this but in my
> opinion it makes designing a big server environment pretty much
> impossible because it would mean that i cannot let any of my user
> generated threads exit unless i want to shutdown completely anyway.
> 
> Perhaps one side note: I am testing and having these issues under Windows.
> 
> 
> I have never been so tempted to use another language while coding in D as i was this time and that makes me sad.
> 
> 
> - Stephan

Hi!

This newsgroup is meant for announcements.  It would be great if you could repost this message in the main newsgroup, digitalmars.D.

Thanks for the bug report, by the way!

-Lars
October 19, 2010
On 19-ott-10, at 12:45, Stephan wrote:

> Hey guys I wanted to discuss my first major depressing experience with D in a reallife project.
>
> First off here is the according bug report : http://d.puremagic.com/issues/show_bug.cgi?id=4951
>
> I have to mention that it was by far not the first bug i encountered in D but it has never been such a PITA. I spent hours and hours of searching, rewriting and crawling my code for the cause of this issue. Just to finally find out that it was not my code but some bug in druntime.
>
> What i do:
> I spawn multiple threads all periodically connecting to some webservers waiting for the request to finish. Every request is totally independent of the others. There is no data sharing in my code. Now i have a protocol that makes my process send one last important request when shutting down. For a clean shut down i wanted to make sure that all the other threads are shut down first. That way the final request of the process is the very last. So i wait for every thread to finish their request and stop them.
> BUT it wont work like that. AFTER i stopped all other threads some strange behavior of druntime makes every creation of an InternetAddress instance (internally trying to resolve host) impossible (throws an exception). Additionally even if the Internet Addresses were created upfront the TcpSockets wont connect but throw.
> I have no idea what the heck is going on inside of the druntime that could cause this but in my opinion it makes designing a big server environment pretty much impossible because it would mean that i cannot let any of my user generated threads exit unless i want to shutdown completely anyway.
>
> Perhaps one side note: I am testing and having these issues under Windows.
>
>
> I have never been so tempted to use another language while coding in D as i was this time and that makes me sad.

I am not sure what is wrong in your case, and I worked only with D1/tango on mac and linux, but I can definitely say that I had quite some very ugly bugs with threads and fibers, and gc.
I think I have fixed all of them (at least everything seems stable now).
Sean&co are welcome to take my fixes from tango into druntime, I release them with whatever license is needed: should I switch to D2 I will not complain if I don't have to debug those horrible things again... ;)

A non druntime bug you should maybe check if you use IP6 is the storage space you alloc for the address structure is large enough: sockaddr is too small, one should use sockaddr_storage (druntime is not always the culprit...).

good luck
Fawzi
October 19, 2010
On Tue, 19 Oct 2010 07:18:50 -0400, Lars T. Kyllingstad <public@kyllingen.nospamnet> wrote:


> Thanks for the bug report, by the way!

Just so nobody tries looking into this cross-posted message, I've already fixed it.

http://www.dsource.org/projects/phobos/changeset/2107

-Steve
October 19, 2010
Fawzi Mohamed wrote:
> I am not sure what is wrong in your case, and I worked only with D1/tango on mac and linux, but I can definitely say that I had quite some very ugly bugs with threads and fibers, and gc.
> I think I have fixed all of them (at least everything seems stable now).
> Sean&co are welcome to take my fixes from tango into druntime, I release them with whatever license is needed: should I switch to D2 I will not complain if I don't have to debug those horrible things again... ;)

Thank you! I (and I'm sure Sean) appreciate this!


> A non druntime bug you should maybe check if you use IP6 is the storage space you alloc for the address structure is large enough: sockaddr is too small, one should use sockaddr_storage (druntime is not always the culprit...).
October 20, 2010
On 19-ott-10, at 20:30, Walter Bright wrote:

> Fawzi Mohamed wrote:
>> I am not sure what is wrong in your case, and I worked only with D1/tango on mac and linux, but I can definitely say that I had quite some very ugly bugs with threads and fibers, and gc.
>> I think I have fixed all of them (at least everything seems stable now).
>> Sean&co are welcome to take my fixes from tango into druntime, I release them with whatever license is needed: should I switch to D2 I will not complain if I don't have to debug those horrible things again... ;)
>
> Thank you! I (and I'm sure Sean) appreciate this!

happy about it :)