ID:               40858
 Updated by:       [EMAIL PROTECTED]
 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:

>The first problem looks weird. It defeats the whole purpose of the
mutex.
The !=NULL check is out of the mutex protected block.


Previous Comments:
------------------------------------------------------------------------

[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.

------------------------------------------------------------------------

[2007-03-19 18:41:15] scottmacvicar at ntlworld dot com

Description:
------------
Appears to be still several more thread safety issues in GD, I've not
had time to track these all down yet.

We're running gdft.c from CVS to fix a few identified issues already.
Looking at the code there still appears to be a race condition within
the code but it appears to be a pretty tight loop since its not
happening as often as before.

By looking at gdft.c it looks possible for a fontCache entry to exist
during a check, by the time it gets to obtaining the lock the fontCache
has been cleared or something similarly evil.

The backtrace we've got is:
http://public.vbulletin.com/bugs/php/gdcache-bt.txt

Patch for first issue to deal with the possibility that a cache entry
is null: http://public.vbulletin.com/bugs/php/gdcache-patch-1.txt

Potential patch for second issue to deal with gdCacheSetup thread
safety: http://public.vbulletin.com/bugs/php/gdcache-patch-2.txt



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=40858&edit=1

Reply via email to