On 04 May 2016, at 11:13 AM, Stefan Eissing <stefan.eiss...@greenbytes.de> 
wrote:

> The problem is not the apr_bucket_destroy(). The file bucket setaside, calls 
> apr_file_setaside(), in core_output on a deferred pool, and then core_output 
> clears that pool. This invalidates all still existing file buckets using that 
> apr_file.

This scenario should still work properly, it shouldn’t cause anything to break.

First off, file buckets need reference counting to make sure that only on the 
last removal of the bucket the file is closed (it may already do this, I 
haven’t looked, but then if it did do this properly it should work).

Next, if a file bucket is setaside, but the reference count isn’t one (in other 
words, other file buckets exist pointing at the same file descriptor in other 
places), and the pool we’re setting aside into isn’t the same or a child pool, 
we should dup the file descriptor during the setaside.

The typical scenario for the deferred pool should be the first scenario above.

Regards,
Graham
—

Reply via email to