User avatar
penguintutor
Posts: 376
Joined: Tue May 08, 2012 9:11 am
Location: UK
Contact: Website

Python program results in system unstable - Possible Bottle mutex problem?

Fri Sep 01, 2017 8:34 pm

Has anyone experienced any issues when using Python Bottle which results in extremely poor performance and/or system instability?

I have a problem with a program I'm writing using Python3. It's a fairly complex bit of code involving Python Tk, which uses python urllib to connect to a webserver using python Bottle and then controls neopixels using a Python neopixel library (manipulates the Raspberry Pi PWM). I don't think my issue is with the graphical application (Tk) as I have tested by running that on a different machine so I think its more a combination of Bottle and NeoPixel or IPC libraries.

Although there is quite a lot going on with this, I wouldn't think that this would be over taxing the Raspberry Pi. Looking at the performance then one processor core does get hit quite hard for a short period of time, but then that drops off. So utilisation appears to be pretty low, but then the Desktop becomes unresponsive. When I try to launch an application then it just hangs (doesn't actually launch) and the PIXEL launcher sometimes becomes unresponsive and even crashes (or at least doesn't show on the screen).

I originally had the neopixels and Bottle in the same program using threading so that they could run simultaneously. I thought it may be due to the performance issues due to the threading locks, so I also tried changing that to multi-processing instead and now I have them as two separate python applications (communicating using posix IPC message queues) and I still get the same instability issues.

My guess is that there is some kind of mutex deadlock. A mutex that is being used by Bottle which is also part of some other code (eg. os / posix / pwm). Has anyone come across this kind of issue and have any suggestions on how to debug it and/or work around it?

I do have some other avenues that I can explore, but I'm hoping that someone may have seen this before an can therefore give me hints of possible solutions.

Return to “Python”