diff options
author | Cliff Woolley <jwoolley@apache.org> | 2003-01-23 01:55:47 +0100 |
---|---|---|
committer | Cliff Woolley <jwoolley@apache.org> | 2003-01-23 01:55:47 +0100 |
commit | 3b060bce5f52d91dd753f134e75e9f174602dadd (patch) | |
tree | 0e92650dc74de51af8d24bcdf9bfce908207b279 /modules/cache/mod_file_cache.c | |
parent | Add mod_ident to the NetWare build (diff) | |
download | apache2-3b060bce5f52d91dd753f134e75e9f174602dadd.tar.xz apache2-3b060bce5f52d91dd753f134e75e9f174602dadd.zip |
Fix a problem whereby multiple MMapFile directives would cause a segfault
on startup.
mod_file_cache keeps a hash table in the cmd->pool and puts an entry in
that hash table for each of its files and mmaps, all of which are opened
into cmd->pool. But it registered a cleanup on cmd->pool that would walk
the hash table and close each file and delete each mmap, even though by
the time that happened those things would have been done already anyway
by the files' and mmaps' own cleanups on cmd->pool. So it was deleting
mmaps that were already cleaned up and closing files that were already
cleaned up in all cases. This has never been valid... amazed it ever
worked. But apparently the true bogosity wasn't revealed until the new
mmap cleanup code went into APR.
PR: 16313
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98463 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/cache/mod_file_cache.c')
-rw-r--r-- | modules/cache/mod_file_cache.c | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/modules/cache/mod_file_cache.c b/modules/cache/mod_file_cache.c index 37209e2744..89b3547d1d 100644 --- a/modules/cache/mod_file_cache.c +++ b/modules/cache/mod_file_cache.c @@ -162,30 +162,6 @@ static void *create_server_config(apr_pool_t *p, server_rec *s) return sconf; } -static apr_status_t cleanup_file_cache(void *sconfv) -{ - a_server_config *sconf = sconfv; - apr_pool_t *p = apr_hash_pool_get(sconf->fileht); - a_file *file; - apr_hash_index_t *hi; - - /* Iterate over the file hash table and clean up each entry */ - for (hi = apr_hash_first(p, sconf->fileht); hi; hi=apr_hash_next(hi)) { - apr_hash_this(hi, NULL, NULL, (void **)&file); -#if APR_HAS_MMAP - if (file->is_mmapped) { - apr_mmap_delete(file->mm); - } -#endif -#if APR_HAS_SENDFILE - if (!file->is_mmapped) { - apr_file_close(file->file); - } -#endif - } - return APR_SUCCESS; -} - static void cache_the_file(cmd_parms *cmd, const char *filename, int mmap) { a_server_config *sconf; @@ -274,10 +250,6 @@ static void cache_the_file(cmd_parms *cmd, const char *filename, int mmap) sconf = ap_get_module_config(cmd->server->module_config, &file_cache_module); apr_hash_set(sconf->fileht, new_file->filename, strlen(new_file->filename), new_file); - if (apr_hash_count(sconf->fileht) == 1) { - /* first one, register the cleanup */ - apr_pool_cleanup_register(cmd->pool, sconf, cleanup_file_cache, apr_pool_cleanup_null); - } } static const char *cachefilehandle(cmd_parms *cmd, void *dummy, const char *filename) |