CherryPy exits after a couple of minutes

87 views
Skip to first unread message

clay...@gmail.com

unread,
Jun 1, 2015, 1:02:27 AM6/1/15
to cherryp...@googlegroups.com
I'm running on a Raspberry Pi with raspbian. Connected to local lan via wifi using a static ip. The app I'm running is the simplest one shown on the cherrypy web site except that I added a config item to use the actual ip address of the pi. Here is the whole app:

import cherrypy

class HelloWorld(object):
    @cherrypy.expose
    def index(self):
        return "Hello world!"

if __name__ == '__main__':

    conf = {
            'global' : {
                'server.socket_host': '10.0.0.120',
                'server.socket_port': 80,
                }
            }

    cherrypy.quickstart(HelloWorld(), '/', conf)


CherryPi starts fine and responds to requests but even if I just leave it alone, it exits after a couple of minutes with the following output:


 [31/May/2015:21:26:37] ENGINE Error in 'start' listener <bound method Server.start of <cherrypy._cpserver.Server object at 0x76fd50>>
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/cherrypy/process/wspbus.py", line 205, in publish
    output.append(listener(*args, **kwargs))
  File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cpserver.py", line 168, in start
    ServerAdapter.start(self)
  File "/usr/local/lib/python2.7/dist-packages/cherrypy/process/servers.py", line 177, in start
    self.wait()
  File "/usr/local/lib/python2.7/dist-packages/cherrypy/process/servers.py", line 233, in wait
    wait_for_occupied_port(host, port)
  File "/usr/local/lib/python2.7/dist-packages/cherrypy/process/servers.py", line 459, in wait_for_occupied_port
    raise IOError("Port %r not bound on %r" % (port, host))
IOError: Port 80 not bound on '10.0.0.120'

[31/May/2015:21:26:37] ENGINE Shutting down due to error in start listener:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/cherrypy/process/wspbus.py", line 243, in start
    self.publish('start')
  File "/usr/local/lib/python2.7/dist-packages/cherrypy/process/wspbus.py", line 223, in publish
    raise exc
ChannelFailures: IOError("Port 80 not bound on '10.0.0.120'",)

[31/May/2015:21:26:37] ENGINE Bus STOPPING
[31/May/2015:21:26:37] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('10.0.0.120', 80)) already shut down
[31/May/2015:21:26:37] ENGINE Stopped thread 'Autoreloader'.
[31/May/2015:21:26:37] ENGINE Stopped thread '_TimeoutMonitor'.
[31/May/2015:21:26:37] ENGINE Bus STOPPED
[31/May/2015:21:26:37] ENGINE Bus EXITING
[31/May/2015:21:26:37] ENGINE Bus EXITED


Sylvain Hellegouarch

unread,
Jun 1, 2015, 3:02:20 AM6/1/15
to cherryp...@googlegroups.com
Hi there,

You should check two things:

* no other process is listening on port 80 already (Apache, nginx?)
* you have the right permissions to bind to that reserved port.

For instance on my machine:

$ sudo netstat -tupln | grep 80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1354/nginx      
tcp6       0      0 :::80                   :::*                    LISTEN      1354/nginx      


- Sylvain



--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-user...@googlegroups.com.
To post to this group, send email to cherryp...@googlegroups.com.
Visit this group at http://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages