httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mladen Turk <>
Subject Re: Problems with EOS optimisation in ap_core_output_filter() and file buckets.
Date Tue, 17 Feb 2009 10:19:05 GMT
Graham Dumpleton wrote:
> 2009/2/17 Mladen Turk <>:
>> Graham Dumpleton wrote:
>>> 2009/2/17 Joe Orton <>:
>>>>> I did used to perform a dup, but was told that this would cause
>>>>> problems with file locking. Specifically was told:
>>>> I'm getting lost here.  What has file locking got to do with it?  Does
>>>> mod_wscgi rely on file locking somehow?
>> I'm lost as well :)
> Consider:
>   fd1 = ....
>   lock(fd1)
>   fd2 = dup(fd1)
>   close(fd2) # will release the lock under some lock APIs even though
> not last reference to underlying file object
>   write(fd1) # lock has already been released so not gauranteed that only writer
>   close(fd1)
> At least that is how I understand it from what is being explained to
> me and pointed out in various documentation.
> So, if fd2 is the file descriptor created for file bucket in Apache,
> if it gets closed before application later wants to write to file
> through fd1, then application has lost its exclusive ownership
> acquired by way of the lock and something else could have acquired
> lock and started modifying it on basis that it has exclusive onwership
> at that time.

Well, like said that won't work, neither is portable
(eg, apr_os_file_t is HANDLE on win32)

What you will need is the code that will take the Python
object and invoke Python file api feeding the apr_bucket.
(Basically writing the apr_bucket_python_file).

However the simplest thing might be an intermediate temp file, in
which case httpd could reference the file name not the file
object itself. Not sure how woule that work with dynamic file
since apr and python might use different platform locking


View raw message