Ticket #844 (defect)
Opened 4 months ago
Last modified 2 months ago
mod_python timeout w/ CherryPy 3.1
Status: closed (fixed)
| Reported by: | guest | Assigned to: | fumanchu |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.1 |
| Component: | CherryPy documentation | Keywords: | |
| Cc: |
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 mod_python example.
This is my test code:
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 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.
Change History
07/25/08 14:47:05: Modified by guest
- milestone set to 3.1.
09/27/08 19:09:33: Modified by fumanchu
- status changed from new to closed.
- resolution set to fixed.
- component changed from CherryPy code to CherryPy documentation.
09/27/08 19:13:24: Modified by fumanchu
3.0.x docs fixed in [2044].


The call to engine.mount() is a mistake in the docs--you don't need it since _cpmodpy calls it for you. I've fixed http://www.cherrypy.org/wiki/ModPython to reflect that.