ID: 40858 User updated by: scottmacvicar at ntlworld dot com Reported By: scottmacvicar at ntlworld dot com Status: Assigned Bug Type: GD related Operating System: RHEL 4 PHP Version: 5.2.1 Assigned To: pajoye New Comment:
Moving the code to PHP_MINIT fixes the problem for PHP but the threading options of GD doesn't extend itself to this setup since the function to create the mutex can be called more than once in a short period of time. This small race condition could be fixed by using pthread_once to ensure the mutexes are allocated only once but I'm unsure of the Win32 equivalent. I've got a patch that implements the PHP solution running on our boxes, I can provide it if interested. Previous Comments: ------------------------------------------------------------------------ [2007-03-19 19:27:31] [EMAIL PROTECTED] Did we not put it inside in the latest version of the last patch? I do not have the code at hand but as far as I remember Nuno updated it. I will check again tonight. ------------------------------------------------------------------------ [2007-03-19 19:24:54] [EMAIL PROTECTED] >The first problem looks weird. It defeats the whole purpose of the mutex. The !=NULL check is out of the mutex protected block. ------------------------------------------------------------------------ [2007-03-19 19:22:00] [EMAIL PROTECTED] Yes, we noticed the cacheSetup problem too. One solution is to initialize it in MINIT and destroy it in MSHUTDOWN. I'm working on patch to implement this solution. The first problem looks weird. It defeats the whole purpose of the mutex. I do not have the time now to test. I will give it a try later this week. ------------------------------------------------------------------------ [2007-03-19 19:13:02] scottmacvicar at ntlworld dot com I should have mentioned, the first patch deals with the segfault so it errors out gracefully. We've got this running on production now. The second patch is an attempt to deal with the race condition that's still present, would probably be simplier to just to call gdFontCacheSetup() again but I'm unsure what the behaviour is of setting up a mutex thats already initialised and then locking it. ------------------------------------------------------------------------ [2007-03-19 18:53:45] [EMAIL PROTECTED] Assigned to the maintainer. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/40858 -- Edit this bug report at http://bugs.php.net/?id=40858&edit=1