Re: [patch] Zend/zend_objects_API.c - bug #29980 (segfault while executing __destruct())

From: Date: Tue, 14 Sep 2004 14:18:29 +0000
Subject: Re: [patch] Zend/zend_objects_API.c - bug #29980 (segfault while executing __destruct())
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-12845@lists.php.net to get a copy of this message
On Mon, 13 Sep 2004 14:02:43 +0300 (IDT) Stanislav Malyshev <stas@zend.com> wrote: > AD>>ATM ZE2 calls destructor at the end of the request and no matter > AD>is>there were a fatal error (which should probably stop executing > AD>the>script). In some cases it leads to nasty segfaults (me and > AD>report's>author can reproduce it, but others can't. weird..). > > Well, the cause of the faults is as follows: > If we are in shutdown, and one of the destructors fails with fatal > error, then other destructors for other objects are not called. Thus, > their if they hold some objects, destructors for these objects will > not be called. Later, when the storage is cleaned with > zend_objects_store_free_object_storage(), engine will attempt to call > dtors for objects that didn't have their dtors called before. However, > on that stage engine is already unable to run PHP code (function and > class tables are already cleaned, etc.) - so it crashes. Looks like you're right, but why others can't reproduce this segfault? > What I would propose is to inhibit calling destructors after > shutdown_destructors() was finished. Sounds nice: we should not call destructors after they were already called =) I could propose a simple solution: add a global flag, which will indicate that shutdown_destructors() was called, and do appropriate check in zend_objects_store_del_ref(). Comments/objections? -- Wbr, Antony Dovgal aka tony2001 tony2001@phpclub.net || antony@dovgal.com

« previous php.internals (#12845) next »