Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7197 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94784 invoked by uid 1010); 20 Jan 2004 13:37:11 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 94760 invoked by uid 1007); 20 Jan 2004 13:37:10 -0000 Message-ID: <20040120133710.94759.qmail@pb1.pair.com> To: internals@lists.php.net Date: Tue, 20 Jan 2004 14:36:50 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 80.126.21.70 Subject: solution for DL's using atexit() From: abies@php.net (Ard Biesheuvel) Hello group, I'm looking for a way to fix http://bugs.php.net/26968. This bug is caused by the underlying client .so using atexit() to register a cleanup function. As the library is unloaded before process shutdown, the atexit() stack no longer contains a valid reference when it is called, resulting in a segfault. IMO there are three ways to fix this: - Use some linker magic to redirect the call to atexit() to a wrapper function that effectively nulls it, and call the cleanup function ourselves in the MSHUTDOWN function. I'm not sure if this is possible, so any help is appreciated. - Disallow unloading of the PHP module. I'm not sure if this is a good idea, but it seems to be the most portable solution, and the most unintrusive, because it will only affect those who actually use the module. - Link the main binary to the client .so instead of just the PHP module. This will make sure that the cleanup function is present when exit() is called, but it kind of defeats the purpose of using shared modules in the first place. Of course, the best solution would be to nuke the atexit() call from the client .so, but since this problem has been around for so long, in both Interbase and Firebird, I'm afraid it's something we will have to deal with ourselves. -- Ard