Perlbal bug: Race condition with web_server role in _serve_request

Jeremy James jbj at
Thu Aug 30 14:09:34 UTC 2007

Hi folks,

We've had problems recently with Perlbal either returning null requests
or otherwise invalid data - on some occasions making Perlbal go into a
100% CPU loop. strace revealed frequent calls to sendfile returning 0
bytes sent.

Looking at the fds involved revealed this was occuring on serving
particular files in web_server mode - indeed files that we know to be
changing quite frequently.

_serve_request in ClientHTTPBase calls aio_stat to decide how to handle
the file - particular with respect to not found, directories, and how to
handle ranges. It then calls aio_open later on, and uses calls
reproxy_fh with the size determined from the earlier stat.

However, our file is being changed in the meantime (in this case, to be
shorter), a overlength read occurs, and anything could happen...

We've bypassed the problem for now (reproxying affected files from
apache), but will work on a patch soon - opening the file first, then
call stat on the filehandle, obviously taking care to handle notfound
and directory cases - although I'd rather there was an official patch,
as I may not have enough understanding of other non-explicit edge cases...

Best wishes,

More information about the perlbal mailing list