RE: WriteData() and EAGAIN (Resource temporarily unavailable)

"Neil Winton" <neil.winton-XZoyATsUNX5Wk0Htik3J/[email protected]> Sun, 9 Nov 2003 12:19:47 -0000
Newsgroups gmane.comp.security.zebedee.general
Message-ID <[email protected]>
Hi,

> I. Topic.
>
> send() returns errno = EAGAIN (Resource temporarily unavailable).
>
> Product - Zebedee 2.4.1.
> Platform - FreeBSD 4.8-STABLE.
>
> II. Problem Description.
>
>     Let the server of application is located on the same host,
> as Zebedee server. The server of application can create a stream of
> the big messages, which are badly compressed.
> For example, loading big .jpeg files through http.
> Zebedee server has not time to transfer this stream in the tunnel
> and returns errno = EAGAIN (Resource temporarily unavailable).
> The increase maxbufsize up to 16383 does not solve a problem.

This isn't behaviour I've seen on any other platform. As far as I can tell
from various man-pages send() should not return EAGAIN unless the socket is
in non-blocking mode (which it will not be). It's possible you see this
behaviour because of the threading implementation under FreeBSD -- in which
case this really ought to be a bug raised against FreeBSD.

The patch you provided looks reasonable, but I'm a little reluctant to
include it because it will impact the performance for all platforms, where
it may only be needed for FreeBSD. I guess I could #ifdef it, but that's
always a bit ugly ...

> P.S.
> It is necessary to process also and other erroneous conditions
> for system calls
> send() and recv(). For example, EPIPE (Broken pipe).

I believe that EPIPE is already catered for (SIGPIPE is caught, so a write
will fail with EPIPE) and the attempt to write will just fail. EPIPE is an
unrecoverable error as far as Zebedee is concerned.

	Regards,
		Neil



-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/