[FASTCGI] getgrgid() and getpwent() not thread-safe causes segfault in worker MPM

Gea-Suan Lin gslin at gslin.org
Thu Jul 16 21:44:58 EDT 2009


Hello all,

We run apache 2.2 with worker mpm (threading model), and use mod_fastcgi
to run PHP 5.2.10 on FreeBSD 7.2-RELEASE-p2.

We found httpd will segfault sometimes (2~3 times in one hour) and tried
to gdb it, then I found bug is that getgrgid() and getpwent() are not
thread-safe.

I use getgrgid_r() and getpwent_r() to rewrite (as attachment) and in
this 12 hours it looks good.

-- 
* Gea-Suan Lin  (public key: Using https://keyserver.pgp.com/ to search)
* If you cannot convince them, confuse them.           -- Harry S Truman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-fcgi_util.c
Type: text/x-csrc
Size: 1799 bytes
Desc: not available
URL: <http://mailman.pins.net/mailman/private.cgi/fastcgi-developers/attachments/20090717/7960f653/attachment.bin>


More information about the FastCGI-developers mailing list