Message5232

Author amak
Recipients amak
Date 2009-10-19.15:08:48
SpamBayes Score 1.5100334e-09
Marked as misclassified No
Message-id <1255964930.92.0.613890276404.issue1489@psf.upfronthosting.co.za>
In-reply-to
Content
I'm finding unusual behaviour running a jython servlet on Tomcat 6.

The bizarre thing is that the behaviour only occurs when Tomcat is run
as a Windows service. It does NOT occur when Tomcat 6 is run from the
command line.

This problem was originally seen by a user running modjy, but I've
written a minimal servlet which recreates the problem without modjy. See
attached source file.

When the jython servlet has an __init__ method, i.e. like so

class jyServlet(HttpServlet):

  def __init__(self):
    HttpServlet.__init__(self)

  def service(self, request, response):
    response.getWriter().write('Hello World!')

then the servlet crashes on Tomcat 6 with the following stacktrace

Traceback (most recent call last):
  File "<string>", line 4, in __init__
RuntimeError: maximum recursion depth exceeded

	org.python.core.PyException.fillInStackTrace(PyException.java:70)
	java.lang.Throwable.<init>(Throwable.java:181)
	java.lang.Exception.<init>(Exception.java:29)
	java.lang.RuntimeException.<init>(RuntimeException.java:32)
	org.python.core.PyException.<init>(PyException.java:46)
	org.python.core.PyException.<init>(PyException.java:43)
	org.python.core.PyException.<init>(PyException.java:61)
	org.python.core.Py.RuntimeError(Py.java:124)
	org.python.core.Py.JavaError(Py.java:450)
	org.python.core.PyTableCode.call(PyTableCode.java:168)
	org.python.core.PyBaseCode.call(PyBaseCode.java:297)
	org.python.core.PyBaseCode.call(PyBaseCode.java:191)
	org.python.core.PyFunction.__call__(PyFunction.java:385)
	org.python.core.PyMethod.__call__(PyMethod.java:215)
	org.python.core.PyMethod.instancemethod___call__(PyMethod.java:221)
	org.python.core.PyMethod.__call__(PyMethod.java:206)
	org.python.core.PyObjectDerived.dispatch__init__(PyObjectDerived.java:1097)
	org.python.core.PyType.invoke_new_(PyType.java:444)
	org.python.core.PyType.type___call__(PyType.java:1397)
	org.python.core.PyType.__call__(PyType.java:1388)
	org.python.core.PyObject.__call__(PyObject.java:381)
	JythonServlet.init(JythonServlet.java:38)
	javax.servlet.GenericServlet.init(GenericServlet.java:212)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
	org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:574)
	org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1527)
	java.lang.Thread.run(Thread.java:619)

When the __init__ method is dropped, i.e. it is defined like so

class jyServlet(HttpServlet):

  def service(self, request, response):
    response.getWriter().write('Hello World!')

Then a different problem occurs: here is the traceback (with > 1000
lines snipped for brevity)

java.lang.StackOverflowError
	java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
	org.python.core.PyStringMap.__finditem__(PyStringMap.java:55)
	org.python.core.PyType.lookup_where(PyType.java:1059)
	org.python.core.PyType.lookup(PyType.java:1048)
	org.python.core.PyReflectedConstructor.__call__(PyReflectedConstructor.java:93)

    [> 1000 identical lines snipped]

	org.python.core.PyReflectedConstructor.__call__(PyReflectedConstructor.java:93)
History
Date User Action Args
2009-10-19 15:08:51amaksetrecipients: + amak
2009-10-19 15:08:50amaksetmessageid: <1255964930.92.0.613890276404.issue1489@psf.upfronthosting.co.za>
2009-10-19 15:08:50amaklinkissue1489 messages
2009-10-19 15:08:48amakcreate