Bug #4008: PHP crashes in module shutdown
| From: | dean dot bennett at home dot com | Date: | Mon, 03 Apr 2000 04:39:23 +0000 |
| Subject: | Bug #4008: PHP crashes in module shutdown | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-17539@lists.php.net to get a copy of this message | ||
From: dean.bennett@home.com
Operating system: Windows 98 & NT
PHP version: 3.0.15
PHP Bug Type: Reproduceable crash
Bug description: PHP crashes in module shutdown
I have been porting the Sybase module to work on Windows platforms, and had a crash that would occur
after php processed the file. It would occur if the dll was loaded with extension= in the php3.ini
file, but NOT if the dll was loaded with the dl() function.
The sybase module allocates some memory in the php3_rinit_sybase() function and releases it in
php3_rshutdown_sybase(). The crash occurs in the efree call (which does a memset to the memory when
the module is compiled in DEBUG mode).
In main.c, the function php3_module_startup() calls start_memory_manager(), a bunch of init
routines, module_startup_modules(), and then shutdown_memory_manager(). The call to
shutdown_memory_manager() nukes the memory on Windows (fills it with 0xdd), which causes it to crash
when it tries to free the memory when the module shutdown is called.
Removing the call to shutdown_memory_manager() prevents the crash. It seems a little odd to
shutdown the memory manager in a startup routine. Perhaps this was meant to be called if the module
startups failed?
This only seems to happen on Windows platforms, I haven't seen a problem yet on any Unix
platforms.