tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "C F" <gis_consult...@hotmail.com>
Subject Tomcat crashing when using PrintWriter & JNI in servlet
Date Tue, 25 Jun 2002 21:48:36 GMT
Hi..... I'm the new guy.
I have an unusual problem.  Hopefully somebody can at least tell me where to 
begin looking.  First, my environment: Red Hat Linux 7.3 Tomcat 4 JDK 1.4

I just have a simple little test servlet that makes a call to a native 
library with JNI and then prints a little "hello" message back to my 
browser.  I general, it works fine... my method is called and I can text 
back at the browser.  However, if I send another request to the servlet 
before the previous is finished (by hitting the refresh button twice fast), 
Tomcat crashes and an error log is generated in the directory of my native 
library.

HOWEVER!  If I take out my PrintWriter calls and leave in my JNI stuff, then 
I have NO problems... I can hit refresh as fast and as many times as I want. 
And vice versa.... if I just leave in my PrintWriter stuff and take out my 
JNI stuff, then I have no problems either.

It's *only* when the two are used and *only* when hit refresh 2 times or 
more fast.  It follows this pattern exactly.  It's nothing random.  Does 
anybody have any idea where I can look?  Is this a coding problem?  Thread 
problem?  Tomcat problem?  JDK problem?  I just have no idea!

Thanks!!

---------------------------------------------------------------
Now a code snippet:
---------------------------------------------------------------
public class myclass extends HttpServlet {
static {
  try {
    System.loadLibrary("mylib");
  } catch (UnsatisfiedLinkError e) {
    e.printStackTrace();
  }
}
public void doGet(HttpServletRequest request, HttpServletResponse response)  
throws IOException, ServletException  {
  PrintWriter out = response.getWriter();
  libObj1 myLibObj1 = new libObj1("constructor");  // from C library
  libObj2 myLibObj2 = myLibObj1.getThing();  // from C library
  myLibObj2.myFunction();  // from C library
  out.println("hello");
  out.close();
}

------------------------------------------------
Some of the error log generated
----------------------------------------------
Unexpected Signal : 11 occurred at PC=0x40213833 
Function=JVM_handle_linux_signal+0x93
Library=/usr/java/j2sdk1.4.0_01/jre/lib/i386/client/libjvm.so

Current Java thread:
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:126)
at 
org.apache.catalina.connector.ResponseBase.flushBuffer(ResponseBase.java:674
)
at 
org.apache.catalina.connector.HttpResponseBase.flushBuffer(HttpResponseBase.
java:764)
at 
org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java
:219)
at
org.apache.catalina.connector.ResponseStream.flush(ResponseStream.java:244)
at sun.nio.cs.StreamEncoder$CharsetSE.implFlush(StreamEncoder.java:409)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:150)
- locked <0x443dc0f0> (a java.io.OutputStreamWriter)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:213)
at java.io.PrintWriter.flush(PrintWriter.java:120)
- locked <0x443dc0f0> (a java.io.OutputStreamWriter)
at
org.apache.catalina.connector.ResponseWriter.flush(ResponseWriter.java:125)
at
org.apache.catalina.connector.ResponseBase.finishResponse(ResponseBase.java:
481)
at 
org.apache.catalina.connector.HttpResponseBase.finishResponse(HttpResponseBa
se.java:237)
at 
org.apache.catalina.connector.http.HttpResponseImpl.finishResponse(HttpRespo
nseImpl.java:287)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1054)
at 
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125
)
at java.lang.Thread.run(Thread.java:536)

Dynamic libraries:
08048000-0804d000 r-xp 00000000 03:02 292710 
/usr/java/j2sdk1.4.0_01/bin/java 0804d000-0804e000 rw-p 00004000 03:02 
292710 /usr/java/j2sdk1.4.0_01/bin/java
40000000-40013000 r-xp 00000000 03:05 63490      /lib/ld-2.2.5.so
40013000-40014000 rw-p 00013000 03:05 63490      /lib/ld-2.2.5.so
.
.
.
... a bunch of stuff...
.
.
.
d635000-4d636000 rw-p 00004000 03:05 63501      /lib/libcrypt-2.2.5.so
4d65d000-4d66b000 r-xp 00000000 03:05 63535      /lib/libresolv-2.2.5.so
4d66b000-4d66c000 rw-p 0000e000 03:05 63535      /lib/libresolv-2.2.5.so

Local Time = Tue Jun 25 00:11:34 2002
Elapsed Time = 26
#
# HotSpot Virtual Machine Error : 11
# Error ID : 4F530E43505002D5
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
#
# Java VM: Java HotSpot(TM) Client VM (1.4.0_01-b03 mixed mode) #







_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message