I don't have this problem on my laptop or VMs I use at work.

I use bottle for my web framework and my python scripts seem to just stop running, requiring me to start them again. I always use a screen for all my Bottle work (on my laptop, VMs, RPi).

The controller on my RPi looks something like this:

from bottle import route, run, template, debug, post, request
import MySQLdb

def batch():

run(host='', port='8080', reloader=True)

Any idea why the script just stops running?

  • How much memory / swap does the Pi use when everything's started up ? Are there any messages in dmesg ?
    – Lawrence
    Mar 27, 2014 at 2:56
  • free -m shows 12M free of 232, and 99M free of swap. How would I tell if there are messages in dmesg related to bottle? If i execute dmesg I receive a bunch of notices about how my temperature probes don't respond to CONVERT_TEMP and take up all the screen. If I do dmesg | grep bottle or dmesg | grep python or dmesg | grep py I receive no results (my controller is named controller.py) Mar 27, 2014 at 5:27
  • When does it stop running? After n number of connections after a specific time, is all ways repeatable?
    – rob
    Mar 27, 2014 at 11:32
  • Have you looked in /var/log/messages as well?
    – Fred
    Mar 27, 2014 at 16:42
  • @rob I generally make one or two connections to it, and if I check back perhaps 10 minutes later it is gone. Always. Mar 31, 2014 at 1:54

1 Answer 1


From the first result on Google...:

I ripped out my home alarm system central box and replaced it with a Raspberry Pi running a small bottle app about 9 months ago, interfacing to a PiFace board. I found the same problem as you. Debugged it for a while but decided it was some odd bug in the generic python wsgi server. Eventually I switched to bjoern server and that problem went away but I found that after some time my app would creep to and stay with high cpu. Then I switched to meinheld server and my small but multi-threaded web app has been running for many months on end, without any issue, and with total CPU load around 5%.

Changing the server is surprising easy. Just sudo apt-get python-pip, sudo pip install meinheld, and then add server="meinheld" to your bottle.run().

BTW, I benchmarked all 17 of the servers which bottle supports natively and found bjoern and meinheld to be significantly the best performing. For my app, they return requests/sec nearly 10 times the rate of the default python wsgi server.

I'll try this and report back.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.