php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17020 Servlet sapi native code problems
Submitted: 2002-05-05 15:32 UTC Modified: 2002-10-25 01:00 UTC
Votes:13
Avg. Score:4.9 ± 0.3
Reproduced:11 of 11 (100.0%)
Same Version:4 (36.4%)
Same OS:5 (45.5%)
From: mark at tapinternet dot com Assigned:
Status: No Feedback Package: Servlet related
PHP Version: 4.2.0 OS: Linux - 2.4.18
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mark at tapinternet dot com
New email:
PHP Version: OS:

 

 [2002-05-05 15:32 UTC] mark at tapinternet dot com
Native code problems with the current servlet sapi.
I've had this problem for over a year.  No one reports that they 
have been successfull getting the servlet sapit to work.
Please help me get PHP to be better.

php-4.2.0
tomcat 4.0.3
j2sdk-1.4.0

info.php
<? phpinfo(); ?>

javax.servlet.ServletException: bailout
	at net.php.servlet.send(Native Method)
	at net.php.servlet.service(servlet.java:188)
	at net.php.servlet.service(servlet.java:212)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
	at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
	at java.lang.Thread.run(Thread.java:536)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-11 00:29 UTC] zack at nostromocorp dot com
I'm also having this problem, but I was only able to get to this point by downloading the source and recompiling the phpsrvlt.jar myself because the jar in the binary distribution did not contain any *.class files!
 [2002-07-12 13:48 UTC] mark at tapinternet dot com
latest php-4.2.1 
latest tomcat-4.1.7 
sun jvm 1.4.0 
After running any php script about 10 times, the whole 
tomcat server dies with output like the following.  All 
signals originatre from zend_hash.c from various functions 
including zend_hash_rehash() and 
zend_hash_index_update_or_next_insert() 
 
 
An unexpected exception has been detected in native code 
outside the VM. 
Unexpected Signal : 11 occurred at PC=0x4CB77EEB 
Function=zend_hash_index_update_or_next_insert+0x2B 
Library=/usr/local/php-servlet/lib/php/libphp4.so 
 
Current Java thread: 
        at net.php.reflect.setResultFromObject(Native 
Method) 
        at net.php.reflect.setResult(reflect.java:105) 
        at net.php.servlet.readCookies(servlet.java:93) 
        at net.php.servlet.send(Native Method) 
        at net.php.servlet.service(servlet.java:188) 
        at net.php.servlet.service(servlet.java:212) 
        at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853) 
...
 [2002-07-12 17:17 UTC] mark at tapinternet dot com
Compiling with --enable-debug and the CFLAG -g3 seems to 
make the servlet SAPI a lot more stable.  add 
--enable-debug to your configure script.  And export an 
environment variable CFLAGS before you configure. 
 
export CFLAGS ="-O3 -mcpu=i686 -march=i686 
-malign-functions=4  -pthread -g3 -Wall -DZTS -prefer-pic" 
 
Make sure that INLINE_CFLAGS is set to this in the 
Zend/Makefile and the TSRM/Makefile.  If not, just change 
them and remake.  You might have to remove libphp4.so and 
sapi/servlet/phpsrvlt.jar to make sure the recompile works 
properly.  Copy the phpsrvlt.jar back to your tomcat 
shared/lib/ folder and re run tomcat.  Now, every php page 
you hit you should see this on the command line: 
 
fopen_wrappers.c(656) :  Freeing 0x084E2DE8 (41 bytes), 
script=- 
servlet.c(334) :  Freeing 0x0822EF30 (4 bytes), script=- 
 
If you see this, you know you're good to go.  Hopefully 
the servlet SAPI will improve stability with ZE2.  I just 
got this working for more than 10 requests, so email me if 
you need any help.  Seems rock solid so far.
 [2002-07-26 10:05 UTC] henrik dot hermansson at hem dot passagen dot se
Thanks Mark!

I followed your instructions and its way better. No crasch yet. I am now able to run phpBB under Tomcat (with custom authorization using servlet filters).

Still, something tells me the bugs are still there, just not as easy to provoke...

PHP 4.2.1 + Tomcat 4.0.4 + Java 1.4.0 (Linux 2.4.7)
 [2002-08-13 16:20 UTC] trhaverstock at yahoo dot com
System config: Win2K, JDK 1.4, PHP 4.2.2, Tomcat 4

I *CAN* get PHP 4.0.6 to work as a servlet with the above config, but cannot get the latest release to work.  I compiled the phpsrvlt.jar myself with 4.2.2 and 4.0.6 and could only get 4.0.6 to work successfully.  

Is there anyone that *can* get 4.2.2 to work on Windows as a servlet?
 [2002-08-29 14:29 UTC] phil at adigital dot com dot mx
Same error on linux,
seems there is a SEGMENTATION FAULT on all the hash code of zend....
Hope this will be debugged soon...

BTW.. it is not *so* visible on PHP as apache .so or cgi, but i think it will ALSO happens sometimes... except that not the whole apache die like tomcat, but just the thread... so you just get a "no server response" sometimes.....
and passes invisible really because or lack of zombs logs under apache
 [2002-10-09 11:29 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2002-10-25 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2002-11-12 10:30 UTC] jcbf at vizzavi dot pt
I've tried with 
Updated Redhat 8.0
Apache Tomcat/4.1.12-LE-jdk14
J2sdk 1.4.1
php 4.2.3 , 4.2.2 and CVS versions up to 200211030600 and STABLE-200211030600 and have the same behavior:

 Runs fine but after some reloads causes a fatal error

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0x4F36516A
Function=zend_hash_index_update_or_next_insert+0x3A
Library=/usr/local/lib/libphp4.so
...
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Aug 14 17:03:49 2022 UTC