Skip to content

Commit 0ba0488

Browse files
committed
mod_cache: Pass the output filter stack through the store_body()
hook, giving each cache backend the ability to make a better decision as to how it will allocate the tasks of writing to the cache and writing to the network. Previously the write to the cache task needed to be complete before the same brigade was written to the network, and this caused timing and memory issues on large cached files. This fix replaces the previous fix for PR39380. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@468373 13f79535-47bb-0310-9956-ffa450edef68
1 parent 8dac4cf commit 0ba0488

6 files changed

Lines changed: 267 additions & 299 deletions

File tree

CHANGES

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
Changes with Apache 2.3.0
33
[Remove entries to the current 2.0 and 2.2 section below, when backported]
44

5+
*) mod_cache: Pass the output filter stack through the store_body()
6+
hook, giving each cache backend the ability to make a better
7+
decision as to how it will allocate the tasks of writing to the
8+
cache and writing to the network. Previously the write to the
9+
cache task needed to be complete before the same brigade was
10+
written to the network, and this caused timing and memory issues
11+
on large cached files. This fix replaces the previous fix for this
12+
PR below. PR39380 [Graham Leggett]
13+
514
*) Fix issue which could cause error messages to be written to access logs
615
on Win32. PR 40476. [Tom Donovan <Tom.Donovan acm.org>]
716

modules/cache/mod_cache.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,7 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
366366
/* pass the brigades into the cache, then pass them
367367
* up the filter stack
368368
*/
369-
rv = cache->provider->store_body(cache->handle, r, in);
370-
if (rv != APR_SUCCESS) {
371-
ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, r->server,
372-
"cache: Cache provider's store_body failed!");
373-
ap_remove_output_filter(f);
374-
}
375-
return ap_pass_brigade(f->next, in);
369+
return cache->provider->store_body(cache->handle, f, in);
376370
}
377371

378372
/*
@@ -829,14 +823,8 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
829823
return ap_pass_brigade(f->next, in);
830824
}
831825

832-
rv = cache->provider->store_body(cache->handle, r, in);
833-
if (rv != APR_SUCCESS) {
834-
ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, r->server,
835-
"cache: store_body failed");
836-
ap_remove_output_filter(f);
837-
}
826+
return cache->provider->store_body(cache->handle, f, in);
838827

839-
return ap_pass_brigade(f->next, in);
840828
}
841829

842830
/*

modules/cache/mod_cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ struct cache_handle {
210210
typedef struct {
211211
int (*remove_entity) (cache_handle_t *h);
212212
apr_status_t (*store_headers)(cache_handle_t *h, request_rec *r, cache_info *i);
213-
apr_status_t (*store_body)(cache_handle_t *h, request_rec *r, apr_bucket_brigade *b);
213+
apr_status_t (*store_body)(cache_handle_t *h, ap_filter_t *f, apr_bucket_brigade *b);
214214
apr_status_t (*recall_headers) (cache_handle_t *h, request_rec *r);
215215
apr_status_t (*recall_body) (cache_handle_t *h, apr_pool_t *p, apr_bucket_brigade *bb);
216216
int (*create_entity) (cache_handle_t *h, request_rec *r,

0 commit comments

Comments
 (0)