waveform80 / picamera

A pure Python interface to the Raspberry Pi camera module
https://picamera.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.57k stars 357 forks source link

PiCamera start_preview blocks indefinitely #724

Open palu3492 opened 2 years ago

palu3492 commented 2 years ago

PiCamera 1.13 Linux raspberrypi 5.10.103+ #1529 Tue Mar 8 12:19:18 GMT 2022 armv6l GNU/Linux

Just came across an issue where PiCamera.start_preview() blocked indefinitely and never returned. I inspected the thread and found it's stuck in the close method of mmalobj.py.

frame = sys._current_frames().get(my_thread.ident, None)
print(frame.f_code.co_filename, frame.f_code.co_name, frame.f_code.co_firstlineno)
('/usr/lib/python2.7/dist-packages/picamera/mmalobj.py', 'close', 663)

Any idea how I can prevent this in the future?