Re: Ides of March [WAS: tsrm_shutdown() and the CLI SAPI]
| From: | Steph Fox | Date: | Tue, 30 May 2006 16:15:05 +0000 |
| Subject: | Re: Ides of March [WAS: tsrm_shutdown() and the CLI SAPI] | ||
| References: | 1 | Groups: | php.gtk.dev php.internals |
| Request: | Send a blank email to internals+get-23782@lists.php.net to get a copy of this message | ||
Short version:
zend_config.w32.h
#define USE_ZEND_ALLOC 1
-#define HAVE_ALLOCA 1
-#define HAVE_LIMITS_H 1
+
+#include <../main/config.w32.h>
In theory that's OK because main/config.w32.h has '#define HAVE_ALLOCA 1' halfway down it.
In practice, the order actually matters.
- Steph
----- Original Message ----- From: "Dmitry Stogov" <dmitry@zend.com>
To: "'Steph Fox'" <steph@zend.com>
Cc: "'PHP-GTK dev'" <php-gtk-dev@lists.php.net>; "'internals'" <internals@lists.php.net>
Sent: Tuesday, May 30, 2006 5:36 AM
Subject: RE: [PHP-DEV] Ides of March [WAS: tsrm_shutdown() and the CLI SAPI]
Hi Steph, As I remember this patch modified "zend_config.w32.h". It made inclusion of "main/config.w32.h" in the same way as on all other systems. How it affects TSRM? May be I forgot something. Thanks. Dmitry.-----Original Message----- From: Steph Fox [mailto:steph@zend.com] Sent: Tuesday, May 30, 2006 1:30 AM To: Dmitry Stogov Cc: 'PHP-GTK dev'; 'internals' Subject: Re: [PHP-DEV] Ides of March [WAS: tsrm_shutdown() and the CLI SAPI] Hi Dmitry, Finally cracked it, and you're right it had nothing to do with the suspected optimizations. There was a win32 memory fix where you included the PHP win32 config file in the Zend one, confusing heck out of TSRM's totally independent (until it meets Zend) alloca definition, which is some way before Zend meets PHP's. They all need to match. Can you find some other way to fix #36568 pliz? I'll take another look at those flags in TSRM itself for the work-aroundable shutdown issues when I've caught up with the weeklies... - Steph ps I knew it had to be you - nobody else did anything major in core that week ;)Hi Steph, I have no idea what is wrong with optimized class/functions tables cleanup. In case if EG(full_tables_cleanup) is set, the behaviorshould be exactlythe same as before patch. PHP uses EG(full_table_cleanup) only for dl(), but I do'tknow how php-gtkuses it. Thanks. Dmitry.-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php __________ NOD32 1.1380 (20060125) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.comthe point of-----Original Message----- From: Steph Fox [mailto:steph@zend.com] Sent: Monday, May 29, 2006 1:40 PM To: internals Cc: PHP-GTK dev; Dmitry Stogov Subject: [PHP-DEV] Ides of March [WAS: tsrm_shutdown() and the CLI SAPI] Hi all, I've spent a fun weekend debugging TSRM and bits of ZE2, having finally figured that the zend_compiler_globals dtor wasand doesn'tfailure here. TSRM needs to mark resources as 'done' following a freeto stay),in most cases, but that's actually not the main problem we have in PHP-GTK (although fixing it may well solve everybody else's, I'll check that on my travels). Dmitry's "Optimized cleanup loops on request shutdown" commit(s) spanning the 13th and 14th March broke Andrei's 'EG(full_tables_cleanup) = 1' ruse (we needed user classes to be cleaned and internal classesmeantime if anyonebut it also broke TSRM shutdown completely for us. PHP-GTK classes are recognized as being internal, but only the first one ever reaches the dtor - even when there are no user-defined classes. zend_hash_reverse_apply() is called at that point, so I'm guessing there's a reentrancy issue behind my access violation crash. I'll get back to this when I get some time, in thecan't put(Dmitry?) wants to play with this you need to know that I14th will do).the 5_2 compat stuff into CVS until Andrei OKs it, so PHP-GTK HEAD has to be built against PHP_5_1 branch at present (anything after MarchUnder CLI ZTS build, when loading a PHP-GTK 2 .dll built against anything this side of PHP 5.1.2 release, I'm seeing an 'access- Stephreaching:violation' crash onif (resource_types_table && !resource_types_table[j].done &&resource_types_table[j].dtor) {resource_types_table[j].dtor(p->storage[j],&p->storage);}Similar code is also used in: tsrm_free_interpreter_context() ts_free_thread() ts_free_worker_threads() ts_free_id() I thought ts_free_thread() was crashing at that line too atthat turned out to be because there's no 'done' checkfirst, butdtors are possible via some functions. It's still vaguelythere, i.e. doublea double flypast causing the crash I'm seeing, but I havepossible there'sknow about protected now. (On my laptop that is.) Eventually I found the resource id for PHP-GTK - the only extension I'm loading during runtime, via php.ini - is 32nd out of a possible 32. "Eventually", because that means I can't use ts_free_id()everything Icrash as advised by Frank (and Tony, and Dmitry, and anyoneto avoid theused that MSHUTDOWN workaround for CLI). Interesting too,else who everresource that causes the crash appears to be somethingbecause theTracking down resource id #5 - and that's all I know aboutcompletely other.it crashes - is a barrel of laughs, I'll let y'all know ifit apart fromwhich of the many possible extensions/files in ext/standardI ever find outShort version: One line is problematic, and only in oneor core it is.presumably only under CLI SAPI. (CGI already doesn't callfunction, andthanks to similar issues some 3 years ago). The question is whether to take 'the Zeev approach' andtsrm_shutdown(),out the tsrm_shutdown() call at the end of sapi/cli/php_cli.c,simply commentspend time knitting up a fine-grained approach to preventor whether toin the function from being called in single-threadedthe one bad lineI've given up on the idea of actually resolving the bug now... Thoughts? - oh, and don't make one of them 'chicken-and-egg' - this is definitively NOT related to the shutdown order in main.c!!!!! - Steph -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php __________ NOD32 1.1380 (20060125) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.comenvironments? I think-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php__________ NOD32 1.1380 (20060125) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.com