broken shutdown for dl()'d modules (HEAD)

php.internals

Wez Furlong

21 years ago
Just noticed some segfaults during shutdown of dl()'d modules from the CLI; this is what I see running under valgrind: ==19025== discard syms in /usr/local/php5/lib/php/extensions/no-debug-non-zts-20040718/pdo_sqlite.so due to munmap() ==19025== discard syms in /usr/local/lib/libsqlite3.so.0.8.6 due to munmap() ==19025== discard syms in /usr/local/php5/lib/php/extensions/no-debug-non-zts-20040718/pdo.so due to munmap() ==19025== Invalid read of size 4 ==19025== at 0x8184ABC: _zval_dtor (zend_variables.c:55) ==19025== by 0x817C2E0: _zval_ptr_dtor (zend_execute_API.c:393) ==19025== by 0x818BE8B: zend_hash_apply_deleter (zend_hash.c:574) ==19025== by 0x818BF19: zend_hash_graceful_reverse_destroy (zend_hash.c:640) ==19025== Address 0x4239AA24 is not stack'd, malloc'd or free'd zsh: 19025 segmentation fault valgrind /usr/local/php5/bin/php ./sqlite.php This looks to be our old friend Mr.-access-pointers-and-functions-after-we-dlclosed-the-module. Sure enough, removing the dlclose() call fixes the segfault. This smells like a shutdown order problem; the script creates two objects, and if I unset them before the script end there is no segfault. --Wez.