Jeff Trawick wrote:
>
> Justin Erenkrantz <[EMAIL PROTECTED]> writes:
>
> > On Tue, Jul 24, 2001 at 06:07:03PM -0400, Greg Ames wrote:
> > > * an assert() trap, also in apr_sendfile, for the problem which is
> > > responsible for the most core dumps on daedalus (APR_SUCCESS + 0 bytes
> > > sent - wtf??), and
> >
> > Could this be from sendfile returning EAGAIN?
>
> Presumably, this piece of code I added a while back would take care of
> that:
>
> /* FreeBSD's sendfile can return -1/EAGAIN even if it
> * sent bytes. Sanitize the result so we get normal EAGAIN
> * semantics w.r.t. bytes sent.
> */
> if (rv == -1 && errno == EAGAIN && nbytes) {
> rv = 0;
> }
>
After lots of staring at apr_sendfile for FreeBSD last night, my head
hurt. So I took advantage of the situation and had a Pain Killer.*
This code snippet doesn't address the core dumps, and doesn't address
Justin's question either, because nbytes must be non-zero. When we
dump, we have nbytes == 0 and rv == 0. My new trap should get us closer
to that problem.
But what if we have rv == -1, EAGAIN, and nbytes == 0 ? I don't think
we handle that properly yet in FreeBSD, nor in Solaris. Looks to me
like the new FreeBSD code will exit apr_sendfile with APR_EAGAIN, and
sendfile_it_all will bail, and the request will die.
However, the new build seems to be running like a champ on FreeBSD.
Maybe we never/rarely see the EAGAIN/nbytes == 0 combination on
daedalus; the FreeBSD kernel might always send out some bytes when it
returns EAGAIN. If we really need to find out what's going on here, I
could put in a couple of counters in shared memory - one for EAGAINs,
one for the EAGAIN/0 bytes combination.
I like the look of the HP apr_sendfile better. If it sees EAGAIN, it
waits for writeability, then calls sendfile a second time.
> We do lots of sendfiles on apache.org but only very occasionally
> (never more than once a day, usually much less often) it fails.
True.
Greg
*Pain Killer
3 shots pineapple juice
2 shots coconut cream
1 shot orange juice
x shots dark rum - I prefer Gosling's Black Seal
(x is proportional to the severity of the pain)
serve over ice. Sprinkle nutmeg on top.
created by:
The Soggy Dollar Bar
(no dock, so you swim ashore from your boat, hence the name)
White Bay
Jost Van Dyke
British Virgin Islands