Skip to content

Commit 59c3f0e

Browse files
committed
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 PR: 69901 Submitted by: barr.israel <barr.israel campus.technion.ac.il> Github: closes #582 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1930632 13f79535-47bb-0310-9956-ffa450edef68
1 parent 040c577 commit 59c3f0e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

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 & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,8 @@ static int mmap_handler(request_rec *r, a_file *file)
275275
apr_mmap_t *mm;
276276
apr_bucket_brigade *bb = apr_brigade_create(r->pool, c->bucket_alloc);
277277

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);
278+
b = apr_bucket_immortal_create((const char *)file->mm->mm,
279+
(apr_size_t)file->finfo.size, c->bucket_alloc);
281280
APR_BRIGADE_INSERT_TAIL(bb, b);
282281
b = apr_bucket_eos_create(c->bucket_alloc);
283282
APR_BRIGADE_INSERT_TAIL(bb, b);

0 commit comments

Comments
 (0)