apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Covener <cove...@gmail.com>
Subject Re: buffered files read after apr_file_close()'ed
Date Tue, 03 Dec 2013 13:33:38 GMT
> What's the least we can do for this case that avoids having to check good
> calls for validity and yet give unmistakable feedback?  Clear the buffer
> pointer during close?

My first thought was the same as Steffan's.  To short-circuit Windows,
where it hangs due to the destroyed mutex, I think we'd need a 2nd
tweak beyond clearing the buffer:

    if (thefile->buffered) {
        char *pos = (char *)buf;
        apr_size_t blocksize;
        apr_size_t size = *len;

        apr_thread_mutex_lock(thefile->mutex);




fd08ddfc 6eec5ca5 libapr_1!apr_thread_mutex_lock+0x29
[C:\cygwin\home\covener\SRC\2.4.x\srclib\apr\locks\win32\thread_mutex.c
@ 89]
fd08de20 6eec64ec libapr_1!apr_file_read+0xe5
[C:\cygwin\home\covener\SRC\2.4.x\srclib\apr\file_io\win32\readwrite.c
@ 186]
fd08de40 6fbd1f7c libapr_1!apr_file_gets+0x2c
[C:\cygwin\home\covener\SRC\2.4.x\srclib\apr\file_io\win32\readwrite.c
@ 455]
fd08fe60 6fbd1eee mod_cache_disk!read_table+0x2c
[C:\cygwin\home\covener\SRC\2.4.x\modules\cache\mod_cache_disk.c @
790]
fd08fe84 6fbe13bf mod_cache_disk!recall_headers+0x7e
[C:\cygwin\home\covener\SRC\2.4.x\modules\cache\mod_cache_disk.c @
884]
fd08feac 6fbe5311 mod_cache!cache_select+0xcf
[C:\cygwin\home\covener\SRC\2.4.x\modules\cache\cache_storage.c @ 254]
fd08fecc 6ff027b9 mod_cache!cache_quick_handler+0x171
[C:\cygwin\home\covener\SRC\2.4.x\modules\cache\mod_cache.c @ 163]
fd08fee8 6ff11f76 libhttpd!ap_run_quick_handler+0x29
[C:\cygwin\home\covener\SRC\2.4.x\server\config.c @ 172]

(line numbers probably don't match any revision exactly, but
read_table is always reading from a closed apr_file_t)

Mime
View raw message