Skip to content

Commit 6797df7

Browse files
committed
Merge r1930632, r1930633 from trunk:
mod_file_cache: Fix crashes for mmap'ed files under threaded MPM. * modules/cache/mod_file_cache.c (mmap_handler): fix file getting unmapped erroneously when server is under load in multi-thread multi-core configuration Follow up to r1930632 - * modules/cache/mod_file_cache.c (mmap_handler): Remove unused variable. PR: 69901 Github: closes #584 Submitted by: barr.israel <barr.israel campus.technion.ac.il>, jorton Reviewed by: jorton, rpluem, covener git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1933635 13f79535-47bb-0310-9956-ffa450edef68
1 parent 30a1002 commit 6797df7

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

changes-entries/pr69901.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*) mod_file_cache: Fix crashes for mmap'ed files under threaded
2+
MPMs. PR 69901. barr.israel <barr.israel campus.technion.ac.il>
3+

modules/cache/mod_file_cache.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,10 @@ static int mmap_handler(request_rec *r, a_file *file)
272272
#if APR_HAS_MMAP
273273
conn_rec *c = r->connection;
274274
apr_bucket *b;
275-
apr_mmap_t *mm;
276275
apr_bucket_brigade *bb = apr_brigade_create(r->pool, c->bucket_alloc);
277276

278-
apr_mmap_dup(&mm, file->mm, r->pool);
279-
b = apr_bucket_mmap_create(mm, 0, (apr_size_t)file->finfo.size,
280-
c->bucket_alloc);
277+
b = apr_bucket_immortal_create((const char *)file->mm->mm,
278+
(apr_size_t)file->finfo.size, c->bucket_alloc);
281279
APR_BRIGADE_INSERT_TAIL(bb, b);
282280
b = apr_bucket_eos_create(c->bucket_alloc);
283281
APR_BRIGADE_INSERT_TAIL(bb, b);

0 commit comments

Comments
 (0)