Camera.Capture() critical failure makes program unresponsive

Jetpack verison 4.5.1

Hey there,

I am running inference on a Jetson Nano using a CSI camera and it works well. I am using a setup similar to the detect-net tutorial here: jetson-inference/detectnet-example-2.md at master · dusty-nv/jetson-inference · GitHub

However, when the camera is not plugged in and when I call “.Capture()” I go into a sort of deadlock state where the python is unresponsive as it waits for the “.Capture()” call to return. The capture call fails and prints the following error to stdout.

(python3:15801): GStreamer-CRITICAL **: 14:13:55.198: gst_mini_object_set_qdata: assertion 'object != NULL' failed
[gstreamer] gstCamera -- end of stream (EOS)
(Argus) Error EndOfFile: Unexpected error in reading socket (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 266)
(Argus) Error EndOfFile: Receiving thread terminated with error (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadWrapper(), line 368)

Weirdly this does not crash the program but rather causes the program to hang and not even respond to ^C.

I am aware that the Jetson.utils C++ interface returns a boolean when Capture() fails but it seems the python call just hangs.

My goal is to exit the process when the camera fails and retry later using systemd. Any input on how I can detect that my camera will error out before this deadlock occurs would be great!

Thanks

Hi @daniel181, there is a timeout parameter to videoSource.Capture() that specifies the number of milliseconds to wait for a new camera frame before returning failure. The default value of the timeout is -1, which means to wait forever. A value of 0 will return instantly if a frame wasn’t immediately ready.

My recommendation is to specify a timeout of 1000 (1 second), like input.Capture(timeout=1000)
If it fails to capture a frame in that time, it will throw an exception that you could catch.

awesome thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.