On 11/7/06, Zoran Vasiljevic <[EMAIL PROTECTED]> wrote:
On 07.11.2006, at 17:02, Bernd Eidenschink wrote: > > I set logmaxlevel to 6 (dev) and I sometimes see lines like: > > Debug: SockSend: Resource temporarily unavailable > Debug: SockSend: Resource temporarily unavailable > (...) Out of the blue, I would not consider this a problem. This is reading on an non-blocking socket that has no bytes in the buffer. Some OS'es emit EAGAIN some EWOULDBLOCK on that place (aparently this OS does EAGAIN).
It's writing, not reading... :-) Anyway, this is actually an error, in the case of the writer thread at least. In nsd/driver.c the writer thread calls Ns_SockSendBufs() and if the return value is not the full amount, an error condition is signalled. I added the debug message because looking at the way code was calling Ns_SockSendBufs() (or Ns_SockSend(), which actually doesn't have this logging message, oops), it was expecting the call to succeed. This wrapper function actually retries to send the data if the first attempt fails, but it only retries *once*, and then it gives up. If you see the above message then I believe the writer thread failed to send all it's data and gave up. I don't think the API is great. It confuses the issue of who's responsible for ensuring data gets written. Is Ns_SockSend* supposed to send all the data or not? I guess the issue is fudged because all the socket is in non-blocking mode, because the read-side does in fact do non blocking reads, the write side was always called by a conn thread and was expecting to write everything before returning. That isn't the case now that there is the writer thread stuff. But either way it's still broken. It sort of half promises to send stuff. Two attempts and then it gives up...