php5 “Unable to fork” on Solaris
Thursday, Dec 6. 2007 – Category: Grommit, OpenSolaris
I was battling with inconsistent behaviour for grommit with PHP5 periodically (50% of the time, roughly) throwing the dreaded “Unable to fork” error (seen on both exec() & passthru() calls). Googling for it gives tons of great info for what causes this problem on Windows; but virtually none on Solaris.
Finally after some truss and DTrace-fu, I saw what was happening. exec() was calling open(), and since httpd is a 32 bit process, it was hitting the 256 file descriptor limit.
Booooooo.
A quick modification to /lib/svc/method/http-apache2 to do a:
ulimit -n 65535
LD_PRELOAD_32=/usr/lib/extendedFILE.so.1
export LD_PRELOAD_32
before the line calling apachectl at the end fixed the problem for me.
Seems like other people should have hit this problem though; which makes me curious why I don’t see any other hits on Google about it.
9 Responses to “php5 “Unable to fork” on Solaris”
Leave a Reply
Recent posts
- my first fake tilt-shift
(Tuesday, Nov 18. 2008 – No Comments) - Album reviews in mashTape
(Tuesday, Nov 18. 2008 – No Comments) - whacked gets fatty
(Sunday, Nov 16. 2008 – 5 Comments) - Songbird 1.0.0rc2 on OpenSolaris
(Sunday, Nov 16. 2008 – 1 Comment)
Categories
- Cars
- ChinaBlog
- Code
- Computers
- Food
- Football
- Grommit
- Linkage
- Movies&TV
- Music
- Musings
- OpenSolaris
- OpenSource
- Outdoors
- Pets
- Photos
- Quotage
- Songbird
- Sun
- Travel
Grommit
Mozilla
OpenSolaris
Songbird
Archives
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- July 2006
- June 2006
- May 2006
- April 2006
- March 2006
- February 2006
- January 2006
- December 2005
- November 2005
- October 2005
- September 2005
- August 2005
- July 2005
- June 2005
- May 2005
- April 2005
- March 2005
- February 2005
- January 2005
- December 2004
- November 2004
- October 2004
- September 2004
- August 2004
- July 2004
- June 2004
- May 2004
- April 2004
- March 2004
- February 2004
- January 2004
- December 2003
- November 2003
- October 2003
- September 2003
- August 2003
- July 2003
- June 2003
- May 2003
- April 2003
- March 2003
- February 2003
- January 2003
- December 2002
- November 2002
- October 2002
- September 2002
- August 2002
- July 2002
- June 2002
- May 2002
- April 2002
- March 2002

December 6th, 2007 at 11:21
It it wasn’t for the ulimit you could have done this in the much more supported (and not going to get blown away on upgrade) way of setting the environment variable using svccfg.
December 6th, 2007 at 11:38
Yeah - I looked at trying to do it with smf properties and svccfg - but couldn’t figure out how because of the ulimit.
December 6th, 2007 at 12:02
So is this the explanation for WordPress not consistently sending email notifications of blog events?
December 6th, 2007 at 12:35
Ugh, 256 default FD limit in a multithreaded, “modern” and “advanced” OS in 2007. Isn’t this silly?
December 6th, 2007 at 13:21
@Geoff: It could be, yeah. Depends if Wordpress was trying to do it all within PHP using sockets & SMTP, or if it was making an exec() call to /usr/lib/sendmail.
@heavygirl: Nope, don’t blame Solaris. Blame POSIX.
December 6th, 2007 at 14:16
the standards define FILE to be opaque, posix shouldn’t care.
I seem to recall the issue is that FILE would change size on applications.
(I also vaguely recall this only being an issue for the 32bit ISAs?)
December 6th, 2007 at 16:12
I saw this issue a lot. I worked at a place that served webpages that literally had 200+ server side includes, and opened dozens of logfiles. Back then the only solution was to upgrade to 64 bit.
December 6th, 2007 at 16:19
Sadly /usr/apache2/bin/apachectl and httpd are delivered as 32-bit only.
January 2nd, 2008 at 03:05
upgrade to latest Nevada, it has 64-bit apache in:
http://blogs.sun.com/jyrivirkki/entry/apache2256is
http://opensolaris.org/os/community/arc/caselog/2007/586/