Skip to content

takePicture sometimes hangs waiting for the capture complete semaphore #14

Description

@caprica

See #9.

When running repeated captures over long periods of time, sometimes the takeCapture method will hang waiting to acquire a semaphore permit that will never occur.

The semaphore is supposed to be released in the encoder buffer callback when the native code invokes that callback with the last frame of image data.

In my own tests, I ran approximately 15 hours of continuous captures, hundreds of thousands of captures, with no problem.

Other people have reported this hang after varying run-times.

The mitigation is to have the semaphore wait call timeout, and if the timeout occurs, destroy the camera and create a new one and then continue. This mitigation works, but ideally we would get to the bottom of the hang.

The present status of this issue is that as far as this library is concerned, I am unsure where to go next. It is possible there is a fault in this library, but it's also possible there's a fault in the underlying native code/driver/OS.

I am unsure if the native JNI picam-2 version shows the same issue or not. So far I have nearly 0.5m captures without incident. I had one inconclusive test that appeared to hang after 3 hours, but I had been dropping lots of code changes onto the Pi around the time that test was running.

Resolution is further frustrated by there not appearing to be much of any help in the native logs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions