Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7232 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28753 invoked by uid 1010); 21 Jan 2004 11:35:13 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 28729 invoked from network); 21 Jan 2004 11:35:13 -0000 Received: from unknown (HELO mail.zend.com) (192.117.235.230) by pb1.pair.com with SMTP; 21 Jan 2004 11:35:13 -0000 Received: (qmail 2523 invoked from network); 21 Jan 2004 11:35:12 -0000 Received: from guardian.zend.office (HELO andi-laptop.zend.com) (10.1.1.4) by mail.zend.com with SMTP; 21 Jan 2004 11:35:12 -0000 Message-ID: <5.1.0.14.2.20040121133428.01fcee30@127.0.0.1> X-Sender: andi@127.0.0.1 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Wed, 21 Jan 2004 13:35:11 +0200 To: Ard Biesheuvel ,internals@lists.php.net In-Reply-To: <20040120133710.94759.qmail@pb1.pair.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] solution for DL's using atexit() From: andi@zend.com (Andi Gutmans) References: <20040120133710.94759.qmail@pb1.pair.com> I don't know if we should get into this. Do we *really* care if we crash on exit? We are talking about MSHUTDOWN not RSHUTDOWN here. It's not an ideal situation but I wouldn't want screw things in PHP just for these dumb shared libraries :) Andi At 02:36 PM 1/20/2004 +0100, Ard Biesheuvel wrote: >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 > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php