apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <...@manyfish.co.uk>
Subject Re: blocking bucket reads on non-blocking sockets
Date Mon, 17 May 2004 12:45:03 GMT
On Fri, May 14, 2004 at 05:36:01PM -0700, Stas Bekman wrote:
> Joe Orton wrote:
> >Oh, the trigger for this is as we discussed before, simply the fact that
> >2.0.49 leaves sockets with O_NONBLOCK set (after the multi-listen DoS
> >security fix) on some platforms.
> 
> Was this fix needed specificaly for HTTP or for any protocols?

It was a bug in the accept/select handling at MPM leve, needed for any
protocols, yes.

> >This doesn't matter for httpd since any request-level filters will use
> >the apr_socket when it has a non-zero timeout set (by the net_time
> >filter), in which case it acts just like a blocking socket.
> >
> >The problem is as you say in protocol-level filters/handlers; there, the
> >apr_socket has no timeout set, so it really does act like a non-blocking
> >socket.
> 
> So what's the solution here?

I'd hoped some friendly buckets guru would step in here :) I guess if
it's correct to solve this at bucket-level, the solution is to make
socket_bucket_read() check whether the socket is non-blocking on each
call, and temporarily set the timeout to -1 if it is...

Or alternatively, for apr_socket_bucket_create() to check once whether 
the socket is non-blocking, and use a wrapper for socket_bucket_read 
which does that.

joe 

Mime
View raw message