Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12900 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46732 invoked by uid 1010); 19 Sep 2004 10:17:55 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 43169 invoked from network); 19 Sep 2004 10:17:26 -0000 Received: from unknown (HELO jc.netevil.org) (69.55.227.66) by pb1.pair.com with SMTP; 19 Sep 2004 10:17:26 -0000 Received: from ([82.133.1.138:61699]) by jc.netevil.org (ecelerity HEAD) with SMTP id AB/00-11136-3BC5D414 for ; Sun, 19 Sep 2004 03:17:24 -0700 Message-ID: <414D5C9B.9090502@thebrainroom.com> Date: Sun, 19 Sep 2004 11:16:59 +0100 User-Agent: Mozilla Thunderbird 0.8 (X11/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: andi@zend.com, internals@lists.php.net Content-Type: multipart/mixed; boundary="------------010902070107060705010207" Subject: broken shutdown for dl()'d modules (HEAD) From: wez@thebrainroom.com (Wez Furlong) --------------010902070107060705010207 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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. --------------010902070107060705010207 Content-Type: text/plain; name="dlshutdown.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="dlshutdown.diff" Index: Zend/zend_API.c =================================================================== RCS file: /repository/ZendEngine2/zend_API.c,v retrieving revision 1.262 diff -u -p -r1.262 zend_API.c --- Zend/zend_API.c 9 Sep 2004 16:51:45 -0000 1.262 +++ Zend/zend_API.c 19 Sep 2004 10:08:17 -0000 @@ -1497,7 +1497,7 @@ void module_destructor(zend_module_entry zend_unregister_functions(module->functions, -1, NULL TSRMLS_CC); } -#if HAVE_LIBDL +#if HAVE_LIBDL && 0 if (module->handle) { dlclose(module->handle); } --------------010902070107060705010207--