[BUG] Using two instances on separate interfaces simultaneously can sometimes fail with "Camera in Configured state trying queueRequest() requiring state Running"
See original GitHub issueDescribe the bug If you initialize two picamera2 objects on different interfaces, then attempt to take pictures with them back-to-back without closing them in-between, they can sometimes fail:
[0:38:03.430892329] [2855] ERROR Camera camera.cpp:533 Camera in Configured state trying queueRequest() requiring state Running
To Reproduce
- Spawn two picamera2 objects on separate interfaces
- start object one, take a picture, then stop it (but don’t explicitly call close())
- attempt to start object 2
– OR –
from picamera2 import Picamera2
def take_pictures(should_close_between=False):
cam1 = Picamera2(0)
cam2 = Picamera2(1)
print('camera 1 seq')
config1 = cam1.create_still_configuration()
cam1.configure(config1)
cam1.start()
cam1.capture_file("sim_test_c1.jpg")
cam1.stop()
if should_close_between:
print('closing camera 1')
cam1.close()
print('camera 2 seq')
config2 = cam2.create_still_configuration()
cam2.configure(config2)
cam2.start()
cam2.capture_file("sim_test_c2.jpg")
cam2.stop()
if not should_close_between:
print('closing camera 1')
cam1.close()
print('closing camera 2')
cam2.close()
print("########## taking two photos, this will work")
take_pictures(should_close_between=True)
print("########## taking two photos, this will fail")
take_pictures()
Expected behaviour It just works™ without having to close the object in between
Console Output, Screenshots
❯ python picamera2_sequential_test.py
########## taking two photos, this will work
[0:37:59.038259411] [2845] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3866-0c55e522
[0:37:59.069626442] [2846] WARN RPI raspberrypi.cpp:1258 Mismatch between Unicam and CamHelper for embedded data usage!
[0:37:59.070797109] [2846] INFO RPI raspberrypi.cpp:1374 Registered camera /base/soc/i2c0mux/i2c@0/imx219@10 to Unicam device /dev/media2 and ISP device /dev/media0
[0:37:59.078736837] [2846] WARN RPI raspberrypi.cpp:1258 Mismatch between Unicam and CamHelper for embedded data usage!
[0:37:59.079869542] [2846] INFO RPI raspberrypi.cpp:1374 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media4 and ISP device /dev/media1
camera 1 seq
[0:37:59.085781209] [2845] INFO Camera camera.cpp:1035 configuring streams: (0) 3280x2464-BGR888
[0:37:59.086328219] [2846] INFO RPI raspberrypi.cpp:761 Sensor: /base/soc/i2c0mux/i2c@0/imx219@10 - Selected sensor format: 3280x2464-SBGGR10_1X10 - Selected unicam format: 3280x2464-pBAA
closing camera 1
camera 2 seq
[0:38:00.432455763] [2851] INFO Camera camera.cpp:1035 configuring streams: (0) 3280x2464-BGR888
[0:38:00.432982440] [2846] INFO RPI raspberrypi.cpp:761 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 3280x2464-SBGGR10_1X10 - Selected unicam format: 3280x2464-pBAA
closing camera 2
########## taking two photos, this will fail
camera 1 seq
[0:38:01.833862282] [2853] INFO Camera camera.cpp:1035 configuring streams: (0) 3280x2464-BGR888
[0:38:01.841378369] [2846] INFO RPI raspberrypi.cpp:761 Sensor: /base/soc/i2c0mux/i2c@0/imx219@10 - Selected sensor format: 3280x2464-SBGGR10_1X10 - Selected unicam format: 3280x2464-pBAA
camera 2 seq
[0:38:02.607401706] [2855] INFO Camera camera.cpp:1035 configuring streams: (0) 3280x2464-BGR888
[0:38:02.608323303] [2846] INFO RPI raspberrypi.cpp:761 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 3280x2464-SBGGR10_1X10 - Selected unicam format: 3280x2464-pBAA
[0:38:03.430892329] [2855] ERROR Camera camera.cpp:533 Camera in Configured state trying queueRequest() requiring state Running
Hardware : Compute Module 4, picamera2 0.3.3, bullseye, 2x imx219
Additional context This doesn’t always reproduce, but once it does it will consistently. I cannot figure out what makes that happen, seems very random.
Issue Analytics
- State:
- Created a year ago
- Comments:19
Top Results From Across the Web
Libcamera Dual Camera Setup - Raspberry Pi Forums
If I run the following command, I get the desired result and performance, but it is in two separate windows since I have...
Read more >asynDriver: Asynchronous Driver Support - Release Notes
Added asynInt64 support for longout, longin, ao, and ai records. This allows these records to be used to communicate with drivers on the...
Read more >3 Bugs and a Thank You in 5.2.7 - NetWorx Help - SoftPerfect
I can then manually start the two portables and, with all 3 running, monitor 3 different interfaces, and when I click the icon...
Read more >Broadcom BNX2 RHEL6 Driver - Lenovo Support NP
They include multiple driver change histories for multiple Linux ... to use new WoL and PM kernel APIs - removed power state changes...
Read more >release-note.md\6.4.0\qt - Qt Project Git Repository Browser
Trying to use an older version will now result in a compile time error. ... 3fc68053db Use qt.qml.states logging category instead of STATECHANGE_DEBUG...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, this is in my plans. I’m busy with other stuff at the moment, and also on holiday at some point, so my guess would be that it’s “a few weeks away”.
This should now be available in the 0.3.6 release, so I’ll close this issue. Please let us know of any problems!