ASF Bugzilla – Attachment 21715 Details for
Bug 39380
mod_disk_cache eats memory, has no LFS support, etc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
FIX corruption in near-simultaneous requests of uncached files for mod_disk_cache jumbo patch - 2.2.6 version
patch_voxel (text/plain), 2.92 KB, created by
Kris Beevers
on 2008-03-25 13:32:02 UTC
(
hide
)
Description:
FIX corruption in near-simultaneous requests of uncached files for mod_disk_cache jumbo patch - 2.2.6 version
Filename:
MIME Type:
Creator:
Kris Beevers
Created:
2008-03-25 13:32:02 UTC
Size:
2.92 KB
patch
obsolete
>diff -ru httpd-2.2.6-patched/modules/cache/mod_disk_cache.c httpd-2.2.6-fixed/modules/cache/mod_disk_cache.c >--- httpd-2.2.6-patched/modules/cache/mod_disk_cache.c 2008-03-25 19:30:01.000000000 +0000 >+++ httpd-2.2.6-fixed/modules/cache/mod_disk_cache.c 2008-03-25 19:47:51.000000000 +0000 >@@ -593,6 +593,7 @@ > dobj->updtimeout = conf->updtimeout; > dobj->removedirs = conf->removedirs; > dobj->header_only = r->header_only; >+ dobj->bytes_sent = 0; > > if(r->filename != NULL && strlen(r->filename) > 0) { > char buf[34]; >@@ -1506,6 +1507,7 @@ > { > apr_bucket *e; > disk_cache_object_t *dobj = (disk_cache_object_t*) h->cache_obj->vobj; >+ apr_off_t bytes_already_done; > > if(dobj->hfd != NULL) { > /* Close header cache file, it won't be needed anymore */ >@@ -1529,18 +1531,23 @@ > } > > /* Insert as much as possible as regular file (ie. sendfile():able) */ >- if(dobj->file_size > 0) { >- if(apr_brigade_insert_file(bb, dobj->bfd, 0, >- dobj->file_size, p) == NULL) >+ /* We need to make sure to skip the beginning of the file if we've >+ already sent some bytes, e.g., due to mod_proxy */ >+ if(dobj->file_size > dobj->bytes_sent) { >+ if(apr_brigade_insert_file(bb, dobj->bfd, dobj->bytes_sent, >+ dobj->file_size - dobj->bytes_sent, p) == NULL) > { > return APR_ENOMEM; > } >+ bytes_already_done = dobj->file_size; >+ } else { >+ bytes_already_done = dobj->bytes_sent; > } > > /* Insert any remainder as read-while-caching bucket */ >- if(dobj->file_size < dobj->initial_size) { >- if(diskcache_brigade_insert(bb, dobj->bfd, dobj->file_size, >- dobj->initial_size - dobj->file_size, >+ if(bytes_already_done < dobj->initial_size) { >+ if(diskcache_brigade_insert(bb, dobj->bfd, bytes_already_done, >+ dobj->initial_size - bytes_already_done, > dobj->updtimeout, p > ) == NULL) > { >@@ -2455,6 +2462,10 @@ > } > > /* Then, populate it with our cached instance */ >+ >+ /* in case we've already sent part, e.g. via mod_proxy */ >+ dobj->bytes_sent = r->bytes_sent; >+ > rv = recall_body(h, r->pool, bb); > if (rv != APR_SUCCESS) { > ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, >diff -ru httpd-2.2.6-patched/modules/cache/mod_disk_cache.h httpd-2.2.6-fixed/modules/cache/mod_disk_cache.h >--- httpd-2.2.6-patched/modules/cache/mod_disk_cache.h 2008-03-25 19:30:01.000000000 +0000 >+++ httpd-2.2.6-fixed/modules/cache/mod_disk_cache.h 2008-03-25 19:34:03.000000000 +0000 >@@ -124,6 +124,8 @@ > apr_interval_time_t updtimeout; /* Cache update timeout */ > > disk_cache_info_t disk_info; /* Disk header information. */ >+ >+ apr_off_t bytes_sent; /* Copy of r->bytes_sent before calling recall_body */ > } disk_cache_object_t; > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 39380
:
18152
|
18154
|
18155
|
18157
|
18158
|
18159
|
18860
|
18861
|
18916
|
18968
|
18969
|
18979
|
18980
|
19418
|
20558
|
21016
|
21519
|
21715
|
22127