httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: What is supposed to happen inside APR when a socket closes.
Date Sun, 13 Feb 2000 19:12:59 GMT

There is a bug in the ap_send/recv code.  Nobody has had a chance recently
to fix this bug, or even really investigate what is going on.  When an
error is return form any system call, APR should return the errno.  I will
be changing ap_send/recv very soon, because setting the length to -1 is
pretty much always wrong.  If no byutes are written, then the length
should be 0, that's what that variable means.

As far as APR returning APR_EOF, that is an invalid return code for the
network code, because not all platforms treat sockets like files.  This
code needs to be fully investigated and there have been other reports of
bugs in this code.  I am hoping to get to it sometime tomorrow, or later
today if I have time after I finish packing my apartment.  :-)

Also, please read the APR Design doc which is in the apr directory.  That
document should detail how APR return codes should be handled.  Also, APR
is still a work in progress, help is always welcome.  If something looks
wrong to you, take a stab at fixing it to make it more logical. 


On Sat, 12 Feb 2000, Jeffrey W. Baker wrote:

> Hi,
> Spent the day trying to wrap my mind around Apache 2.0 and why it chokes
> on clients closing a kept-alive connection.  I need to get inside the
> head of whoever designed this because the correct fix is not that
> obvious.
> The problem is that ap_recv in src/lib/apr/network_io/unix/sendrecv.c
> doesn't seem to do the right thing when the socket closes.  read()
> returns -1 and errno is set to EPIPE, of course.  ap_recv sets the *len
> (*bytes_read elsewhere) to -1 and returns APR_SUCCESS, which definitely
> seems like the wrong thing.  Eventually the fb->incnt gets set to -1 and
> everything goes to hell.
> The solution in my mind is to handle EPIPE explicitly and set *len to 0
> and return APR_EOF.  APR_EOF doesn't appear anywhere in the network_io
> code so I guess I must be missing something obvious.
> -jwb

Come to the first official Apache Software Foundation
Conference!!!   <http://ApacheCon.Com/>

Ryan Bloom               
2121 Stonehenge Dr. Apt #3
Raleigh, NC 27615		Ryan Bloom -- thinker, adventurer, artist,
				     writer, but mostly, friend.

View raw message