From nobody@FreeBSD.org  Mon Dec  6 17:38:24 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id BB7ED16A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  6 Dec 2004 17:38:24 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id A26A243D2F
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  6 Dec 2004 17:38:24 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id iB6HcOhs065037
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 6 Dec 2004 17:38:24 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id iB6HcONn065015;
	Mon, 6 Dec 2004 17:38:24 GMT
	(envelope-from nobody)
Message-Id: <200412061738.iB6HcONn065015@www.freebsd.org>
Date: Mon, 6 Dec 2004 17:38:24 GMT
From: Peter Jeffery <peterj@qubesoft.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] php5 crashes with threaded apache2
X-Send-Pr-Version: www-2.3

>Number:         74780
>Category:       ports
>Synopsis:       [patch] php5 crashes with threaded apache2
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    ale
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 06 17:40:20 GMT 2004
>Closed-Date:    Mon Jan 10 17:02:16 GMT 2005
>Last-Modified:  Mon Jan 10 17:02:16 GMT 2005
>Originator:     Peter Jeffery
>Release:        5.3-Stable
>Organization:
Qube Software
>Environment:
FreeBSD poblano.qubesoft.com 5.3-STABLE FreeBSD 5.3-STABLE #8: Tue Nov 30 19:38:43 GMT 2004   root@poblano.qubesoft.com:/usr/obj/usr/src/sys/PETE  i386
>Description:
(Sorry if this is a duplicate, but I think the original didn't make it using command line send-pr)

When using the php5 module in apache2 (apache-worker-2.0.52_3) it regularly crashes when trying to process non-trivial php files. After some experimentation it seemed that this was due to stack overflow problems and to back that up I found this:

http://www.phpbuilder.com/lists/php-developer-list/2003072/0051.php

Which is a patch for HPUX which also has 64k thread stack sizes. This seems to have fixed the problem


>How-To-Repeat:
compile apache2 WITH_MPM=worker and then php5 so that it builds itself in threaded mode.

I don't have any specific php files to provide as they are not yet public, but a normal 650 line file with a bunch of functions in it crashed httpd everytime. Also compiling Smarty templates would pretty much always crash httpd. This patch fixes that.      
>Fix:
--- Zend/zend.h.orig    Mon Dec  6 15:42:56 2004
+++ Zend/zend.h Mon Dec  6 15:46:40 2004
@@ -176,7 +176,7 @@
 #endif


-#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32)) && !(defined(ZTS) && defined(NETWARE)) && !(defined(ZTS) && defined(HPUX)) && !defined(__darwin__) && !defined(__APPLE__)
+#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32)) && !(defined(ZTS) && defined(NETWARE)) && !(defined(ZTS) && defined(HPUX)) && !defined(__darwin__) && !defined(__APPLE__) && !(defined(ZTS) && defined(__FreeBSD__))
 # define do_alloca(p) alloca(p)
 # define free_alloca(p)
 #else

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->ale 
Responsible-Changed-By: thierry 
Responsible-Changed-When: Mon Dec 6 17:45:18 GMT 2004 
Responsible-Changed-Why:  

Over to maintainer. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=74780 

From: Henri Hennebert <hlh@ciger.be>
To: freebsd-gnats-submit@FreeBSD.org, peterj@qubesoft.com
Cc:  
Subject: Re: ports/74780: [patch] php5 crashes with threaded apache2
Date: Mon, 10 Jan 2005 12:24:12 +0100

 I encounter this problem with PHP_4.3.10 and the submitted patch fix it.
 
 Thanks
 
 Henri
State-Changed-From-To: open->closed 
State-Changed-By: ale 
State-Changed-When: Mon Jan 10 17:02:01 GMT 2005 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74780 
>Unformatted:
