httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niklas Edmundsson <ni...@acc.umu.se>
Subject [PATCH] sendfile_nonblocking broken in trunk
Date Wed, 04 Oct 2006 14:14:56 GMT

I stumbled upon this when porting the mod_disk_cache 
read-while-caching feature to trunk. r-w-c uses a diskcache bucket 
which it morphs into file buckets as more data becomes available.

Ie, it starts with a brigade containing:
FILE-DISKCACHE

FILE is sendfile:d as usual by core_filters, and when DISKCACHE is 
bucket_read() it morphs the bucket into a 0-length HEAP bucket, a FILE 
bucket and the remains in a trailing DISKCACHE bucket, ie: 
HEAP-FILE-DISKCACHE

send_brigade_nonblocking() correctly does the bucket_read and moves on 
to the next bucket which it correctly identifies as a FILE bucket and 
tries to sendfile_nonblocking().

sendfile_nonblocking() takes the _brigade_ as an argument, gets the 
first bucket from the brigade, finds it not to be a FILE bucket and 
barfs.

The attached fix is trivial, and I really can't understand why 
sendfile_nonblocking() was taking a brigade instead of a bucket as 
argument in the first place.

On a side note, in send_brigade_nonblocking() it's unnecessary to 
queue 0-length writes to the iovec. It probably won't do any 
difference at all in real world performance but it's obviously not 
optimal ;)

Also, I'm not at all fond of all those "XXX: We really should 
log/return error/foo here"-lines. It's not THAT hard doing it while 
coding, or at least do a final touchup before submitting a 
patch/comitting code...

/Nikke - now able to do some QA before submitting mod_disk_cache
          patches.
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  Niklas Edmundsson, Admin @ {acc,hpc2n}.umu.se      |     nikke@acc.umu.se
---------------------------------------------------------------------------
  My stereo's «-fixed, said Tom monotonously.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Mime
View raw message