Bug 55833 - mod_disk_cache reads from closed files
Summary: mod_disk_cache reads from closed files
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_cache_disk / mod_disk_cache (show other bugs)
Version: 2.4.6
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Keywords: FixedInTrunk, PatchAvailable
Depends on:
Reported: 2013-12-02 00:34 UTC by Eric Covener
Modified: 2014-08-18 08:24 UTC (History)
0 users

close headers.fd only when declining open_entity (928 bytes, patch)
2013-12-02 17:26 UTC, Eric Covener
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Covener 2013-12-02 00:34:14 UTC
mod_disk_cache reads and closes hdrs.fd in recall_headers() but clearly closes hdrs.fd in open_entity (the immediately preceding callback).

On unix, the read from the closed file seems to be tolerated because they are open with buffering, but I think this is not intended.

IIUC, hdrs.fd should be left open from branches that return OK, and closed on the others.  Or the relatively short data should be buffered explicitly somewhere in memory / mod_disk_cache.
Comment 1 Eric Covener 2013-12-02 17:26:32 UTC
Created attachment 31087 [details]
close headers.fd only when declining open_entity
Comment 2 Christophe JAILLET 2014-08-18 08:24:35 UTC
Fixed and released in 2.4.8