Issue #844 resolved

mod_python timeout w/ CherryPy 3.1

guest
created an issue

I'm using CherryPy 3.1 with Apache 2.0.59, Python 2.5.2 and mod_python 3.3.1 on Mac OS 10.5.4, and I'm testing my installation with the code from the [wiki:ModPython mod_python example].

This is my test code:

{{{

!python

import cherrypy

class Root: @cherrypy.expose def index(self): return 'Hi there, Ho there, Hey there'

def setup_server(): # Set up site-wide config. Do this first so that, # if something goes wrong, we get a log. cherrypy.config.update({'environment': 'production', 'log.screen': False, 'log.error_file': 'site.log', 'server.socket_host': '127.0.0.1', 'show_tracebacks': False})

cherrypy.tree.mount(Root())
cherrypy.engine.start()

}}}

I modified the code according to details in [wiki:UpgradeTo31].

Here is my Apache configuration in httpd.conf:

{{{

<Location "/myapp"> PythonPath "sys.path+['/Users/tim/Desktop']" SetHandler python-program PythonHandler cherrypy._cpmodpy::handler PythonOption cherrypy.setup myapp::setup_server PythonDebug On </Location>

}}}

(My test code is at /Users/tim/Desktop/myapp.py)

When I first load the application in my browser (via http://localhost:8888/myapp), CherryPy behaves as expected. But if I wait several seconds before reloading the app, mod_python prints "Unrecoverable error in the server.", and I get this message in my error log:

{{{

[25/Jul/2008:15:06:04] ENGINE Bus STARTING [25/Jul/2008:15:06:04] ENGINE Started monitor thread '_TimeoutMonitor'. [25/Jul/2008:15:06:09] ENGINE Error in 'start' listener <bound method Server.start of <cherrypy._cpserver.Server object at 0x438f470>> Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/CherryPy-3.1.0-py2.5.egg/cherrypy/process/wspbus.py", line 147, in publish output.append(listener(args, kwargs)) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/CherryPy-3.1.0-py2.5.egg/cherrypy/_cpserver.py", line 89, in start ServerAdapter.start(self) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/CherryPy-3.1.0-py2.5.egg/cherrypy/process/servers.py", line 53, in start wait_for_free_port(self.bind_addr) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/CherryPy-3.1.0-py2.5.egg/cherrypy/process/servers.py", line 209, in wait_for_free_port raise IOError("Port %r not free on %r" % (port, host)) IOError: Port 8080 not free on '127.0.0.1'

[25/Jul/2008:15:06:09] ENGINE Shutting down due to error in start listener: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/CherryPy-3.1.0-py2.5.egg/cherrypy/process/wspbus.py", line 180, in start self.publish('start') File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/CherryPy-3.1.0-py2.5.egg/cherrypy/process/wspbus.py", line 147, in publish output.append(listener(args, kwargs)) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/CherryPy-3.1.0-py2.5.egg/cherrypy/_cpserver.py", line 89, in start ServerAdapter.start(self) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/CherryPy-3.1.0-py2.5.egg/cherrypy/process/servers.py", line 53, in start wait_for_free_port(self.bind_addr) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/CherryPy-3.1.0-py2.5.egg/cherrypy/process/servers.py", line 209, in wait_for_free_port raise IOError("Port %r not free on %r" % (port, host)) IOError: Port 8080 not free on '127.0.0.1'

[25/Jul/2008:15:06:09] ENGINE Bus STOPPING [25/Jul/2008:15:06:09] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('127.0.0.1', 8080)) already shut down [25/Jul/2008:15:06:09] ENGINE Stopped thread '_TimeoutMonitor'. [25/Jul/2008:15:06:09] ENGINE Bus STOPPED [25/Jul/2008:15:06:09] ENGINE Bus EXITING [25/Jul/2008:15:06:09] ENGINE Bus EXITED [25/Jul/2008:15:06:09] MOD_PYTHON Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/CherryPy-3.1.0-py2.5.egg/cherrypy/_cpmodpy.py", line 139, in handler setup(req) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/CherryPy-3.1.0-py2.5.egg/cherrypy/_cpmodpy.py", line 84, in setup func() File "/Users/tim/Desktop/myapp.py", line 20, in setup_server cherrypy.engine.start() File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/CherryPy-3.1.0-py2.5.egg/cherrypy/process/wspbus.py", line 180, in start self.publish('start') File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/CherryPy-3.1.0-py2.5.egg/cherrypy/process/wspbus.py", line 147, in publish output.append(listener(args, kwargs)) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/CherryPy-3.1.0-py2.5.egg/cherrypy/_cpserver.py", line 89, in start ServerAdapter.start(self) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/CherryPy-3.1.0-py2.5.egg/cherrypy/process/servers.py", line 53, in start wait_for_free_port(self.bind_addr) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/CherryPy-3.1.0-py2.5.egg/cherrypy/process/servers.py", line 209, in wait_for_free_port raise IOError("Port %r not free on %r" % (port, host)) IOError: Port 8080 not free on '127.0.0.1'

}}}

This problem does not seem to occur in CherryPy 3.0.2.

I appreciate your assistance,

Tim E.

Comments (4)

  1. Log in to comment