info-beamer pi 0.9.1 releasedPosted Jun 28 2015 by Florian Wesch
info-beamer 0.9.1 fixes a bug introduced in 0.9 that could lead to info-beamer getting stuck.
If you're not interested in all the technical details you can freely ignore the following blog post and just download the latest version.
Getting stuck. And how to fix it.
OpenMAX IL aka OMX is the API used by info-beamer on the PI to accelerate video playback. The API is pretty wierd since it's an asynchronous API. So there are a few functions that you call that then do things behind the scenes and trigger a callback (in another thread) once the operation is done. In the case of OMX you pass an undecoded video packet to the system. It then starts decoding. Once a complete video frame is decoded you get callback that notifies you that a new video frame is now available as an OpenGL texture.
Inside this callback I used a lock to safely check a state variable that keeps track of what the video player is doing (loading, playing, being paused, finishing). Holding this lock was a bad idea. It seemed that before the OMX implementation called my callback function it also acquired some internal lock.
If you previously wrote a multithreaded program you'll know that when you need to acquire two different locks you probably should always try to acquire them in the same order. Otherwise it might happen that thread 1 acquires lock A while thread 2 acquires lock B. If thread 1 then tries to acquire lock B it is already taken. The same thing happens if thread 2 then tries to acquire lock A. The result is a deadlock. Which basically means that your program is waiting for a condition that will never occur thus being stuck.
This happend in info-beamer: Before one of my callback functions was called, OMX internally acquired a lock (I'll call this the OMX lock). At the same time a call to video.start acquired a lock internally to info-beamer (I'll call it the the state lock). OMX them proceeded to call my callback function notifying me that a new video frame got decoded. In that callback function I tried to acquire the state lock which at this point was already taken. The result is that the callback got stuck. At the same time the call to video.start called some OMX function to configure the playback speed clock. This function then tried to acquire the OMX lock which at this point was already taken by the callback. As a result this function call got stuck as well.
The internal info-beamer watchdog detected that the info-beamer process didn't make any progress and triggered the
[main.c] stuck while running node 'example'. trying to get a traceback [main.c] didn't get a traceback. the code is most likely stuck in a jit compiled inner loop CRITICAL ERROR: stuck in node 'example'
This bug is fixed now and version 0.9.1 is ready to download.
Recent blog postsinfo-beamer hosted 9 released
info-beamer hosted on the CM3-PANEL
info-beamer hosted CEC support
info-beamer pi 0.9.9 released
info-beamer.com offers the most advanced digital signage platform for the Raspberry Pi. Fully hosted, programmable and easy to use. Learn more...
Get started for free!
Trying out the best digital signage solution for the Raspberry Pi is totally free: Use one device and 1GB of storage completely free of charge. No credit card required.
Follow @infobeamer on twitter to get notified of new blog posts and other related info-beamer news. It's very low traffic so just give it a try.
You can also subscribe to the RSS feed.
Share this post:
Questions or comments?
Get in contact!