raspberrypi / picamera2

New libcamera based python library
BSD 2-Clause "Simplified" License
891 stars 188 forks source link

[HOW-TO] Handle expiring dequeue timer #883

Open mikkelam opened 11 months ago

mikkelam commented 11 months ago

Im experiencing this problem:

[30:53:22.756254716] [24]  WARN V4L2 v4l2_videodevice.cpp:2007 /dev/video0[18:cap]: Dequeue timer of 2050000.00us has expired!
[30:53:22.857605901] [24] ERROR RPI pipeline_base.cpp:1337 Camera frontend has timed out!
[30:53:22.857668456] [24] ERROR RPI pipeline_base.cpp:1338 Please check that your camera sensor connector is attached securely.
[30:53:22.857686734] [24] ERROR RPI pipeline_base.cpp:1339 Alternatively, try another cable and/or sensor.

on an RPI 4 with the HQ camera. I'm wondering how to go about handling it, and what it actually means.

Describe alternatives you've considered I've tried increasing the timeout with the rpi_apps.yaml file, but that seems to totally kill my system. Should I perhaps lower it instead of increasing it?

Additional context It seemed to start happening for me after i started doing a lot of background processing on my 3 other cores while using 1 core to take images. I also tried to increase the buffer_count but didn't see any improvements either

davidplowman commented 11 months ago

Assuming that you're running your camera "normally" (that is, not trying to put it into any kind of external trigger mode) then this kind of problem is normally caused by:

The one that springs to mind first would be the power supply question - it's quite possible that those extra cores are now pulling more power. Can you say what kind of power supply you have?

After that it's worth checking those other items in the list, and swapping out components if you have spares. Is it the case that simply running a preview window causes this, or does it tend to lock up when it tries to do a full resolution capture?

mikkelam commented 11 months ago

Spent a full day on this david. Thanks for all these suggestions, my team tried all of the above. Lastly, we realised we were just running out of memory... If you see this in the future - lack of memory can be added to the list

davidplowman commented 11 months ago

Thanks for the update. That's interesting that you were running out of memory, I wouldn't particularly have expected it to fail like that. Have you found any workarounds, like adding more swap? Or is it a case of "use less", or "get a bigger Pi"? If the memory is being used up by camera buffers, it can sometimes be possible to use less memory-hungry image formats.

mikkelam commented 11 months ago

Thanks for the update. That's interesting that you were running out of memory, I wouldn't particularly have expected it to fail like that. Have you found any workarounds, like adding more swap? Or is it a case of "use less", or "get a bigger Pi"? If the memory is being used up by camera buffers, it can sometimes be possible to use less memory-hungry image formats.

Yeah, upgrading our RPIs from 2GB to the comfortable 4GB seemed to the trick :-) I was also quite surprised that it showed up liked that

naushir commented 11 months ago

This seems a bit strange, lack of memory should not trigger this timeout. I suspect there may been something wrong with the 2GB Pi connector.