Newsgroups: php.internals,php.internals Path: news.php.net Xref: news.php.net php.internals:21120 php.internals:21134 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58260 invoked by uid 1010); 9 Dec 2005 05:11:44 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 58244 invoked from network); 9 Dec 2005 05:11:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Dec 2005 05:11:44 -0000 X-Host-Fingerprint: 80.74.107.235 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from ([80.74.107.235:61645] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id E8/BD-14828-CE119934 for ; Fri, 09 Dec 2005 00:11:09 -0500 Received: (qmail 7754 invoked from network); 9 Dec 2005 02:24:24 -0000 Received: from localhost (HELO ANDI-NOTEBOOK.zend.com) (127.0.0.1) by localhost with SMTP; 9 Dec 2005 02:24:24 -0000 Message-ID: <7.0.0.16.2.20051208182336.05abbcb0@zend.com> X-Mailer: QUALCOMM Windows Eudora Version 7.0.0.16 Date: Thu, 08 Dec 2005 18:24:17 -0800 To: david_oren@excite.com,internals@lists.php.net In-Reply-To: <20051208081523.8777F2999F@xprdmailfe21.nwk.excite.com> References: <20051208081523.8777F2999F@xprdmailfe21.nwk.excite.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] Bugs in zend.c and zend_compile.c in ZTS mode From: andi@zend.com (Andi Gutmans) Hi David, Would be happy to take a look at these bugs. Any chance you can send a short reproducing script? Thanks, Andi At 12:15 AM 12/8/2005, David Oren wrote: >Hello all, > > > >I have recently switched to PHP 5.1, and have been encountering >crashes during shutdown. I have tried delving into the PHP code to >locate the source of the problems, and have discovered two issues, >both of which only happen when compiled with ZTS enabled. > > > >The first is very probably a bug. > > > >In zend_compile.c, in the zend_initialize_class_data function, >inside the #ifdef ZTS block, the following line can be found: > > > > ce->static_members = (HashTable*)n; > > > >This casts an int variable, which denotes an index of the >static_members array, to a pointer. I assume what was meant is: > > > > ce->static_members = (HashTable*) (CG(static_members)[n]); > > > >In addition, support for runtime declaration (handled by the if >block) is broken, as it will not work when CG(static_members) is >NULL and we're trying to add the first member, so the if block >should be followed by an else block similar to this one. > > > > else if (!CG(static_members)) { > > // n is probably 0 at this point > > CG(last_static_member) = n+1; > > CG(static_members) = (HashTable**)calloc(n+1, sizeof(HashTable*)); > > } > > > >If needed, I can provide a patch for this issue. > > > >The second issue _may_ be a bug, but I'm not familiar enough with >the Zend Engine internals to be certain. > > > >In zend.c, the zend_post_startup function unlinks the global (r/o) >copies of several tables, and creates fresh r/w copies for the startup threads. > > > > >From looking at the code, it would seem that the unlinking of the > persistent_list is NOT done cleanly: The persistent list of the > running thread is destroyed and reinitialized (by > executor_globals_ctor), and this is what the global_persistent_list > variable points to. In other words, the global persistent list is > shared with the startup thread. > > > >Again, in this case it _feels_ wrong, but this may also be what was intended. > > > >I hope I've managed to make sense, and I'd appreciate any feedback on this. > > > >Thanks, > > > >David Oren > > > >_______________________________________________ >Join Excite! - http://www.excite.com >The most personalized portal on the Web! > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php