Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

SocketConduit Timeout issue

Moderators: kris

Posted: 05/26/08 10:11:02


I have a problem where my server keeps telling me my connection has timed out when I connect to it. This only happens if I let a connection timeout first, I have noticed that there is code in SocketConduit?.read(void[],uint delegate(void[])) that sets it to false, but none in SocketConduit?.write(void[]), which makes sense except in the case where there is a timeout and the SocketConduit? gets reused and has to be written to.

Also seem to get some weird timeouts like timed out after 0:1:119.119995 when I've set the timeout to 2min.

I am using 0.99.6, on ubuntu 8.04.


Author Message

Posted: 05/26/08 19:01:50

Yes, there's support for timeout on socket reads, but not currently for writes. The read timeout is disabled until you explicitly set a timeout value. For example, HttpClient sets the read timeout to be three seconds

Posted: 05/27/08 09:30:41

What I suspect is that the timeout is sometimes not being reset. And then when the SocketConduit? is reused from the freelist, if the code checks if that SocketConduit? has timed out it remembers a different connections timeout value(true/false), when actually the connection has only just been opened and could not have timed out.

I am suggesting that SocketConduit?.timeout should be set to false either in SocketConduit?.allocate, SocketConduit?.write, or some other place where a SocketConduit? is placed onto the freelist.


Posted: 05/27/08 16:27:17

ooooh ... I missed that part in the original post ... however, timeout is set to false before each read() operation, so wouldn't that take care of it? Or, are you testing for timeout before a read() ?

Posted: 06/05/08 14:57:43

Thanks I forgot to remove the timeout checks from my write method, after you told me about that, I still believe there should be a reset for SocketConduits? when they are reused though.

Do you know when timeouts will be supported in SocketConduit?.write? Is there something special about socket writing that makes it harder than reading for timeouts?


Posted: 06/06/08 01:18:37

necessity was the driving force with read timeouts :)