depthai-core
depthai-core copied to clipboard
`Device` start race condition causes no `ImgFrame` to be received by host
When the thread creating a Device takes longer than ~600ms between creating that Device and getting OutputQueue(s), a race condition occurs which results in no ImgFrame
being received by the host.
Setup
- depthai-core v2.15.1 and develop d5349cada8c94b766b50c6f0f22b25f753e7cabf
- VS2019 v16.11.11
- Microsoft Windows [Version 10.0.19044.1586]
- oak-d-lite or oak-d
Repro
- build the code at https://github.com/diablodale/depthai-core/blob/repro442-startuprace/tests/src/startup_race.cpp
- Run
startup_race.exe
Result
Test fails. It correctly receives 4+ sysinfo frames. It fails to receive color or depth frames. Yet on program exit, it strangely receives exactly one pair of color+depth frames.
C:\njs\depthai-core\build\tests>startup_race.exe
simulate busy thread for 1000 milliseconds... completed
wait 3 sec; parallel callbacks should receive 70+ color&depth frames and 4+ temperature frames
temp 33.4467
temp 34.2227
temp 33.6262
temp 33.7447
temp 33.865
temp 33.9247
total frames received color=0 depth=0 temp=6
FAILED TEST
exit program
color 16
depth 16
Expected
For all thread wait values, the app should receive 4+ sysinfo frames, 70+ depth frames, 70+ color frames
To see success, run startup_race.exe 100
. The 100 is the number of milliseconds to pause the thread...the race condition.
C:\njs\depthai-core\build\tests>startup_race.exe 100
simulate busy thread for 100 milliseconds... completed
wait 3 sec; parallel callbacks should receive 70+ color&depth frames and 4+ temperature frames
color 4
depth 4
color 5
depth 5
color 6
depth 6
...
color 92
depth 92
color 93
depth 93
total frames received color=90 depth=90 temp=6
exit program
Notes
On my computer, the race condition occurs when the thread is paused ~623ms. Less than that, it works. More than that, it fails.
Thanks - will take a look over the weekend
Ping. Continues to fail in v2.25.0. I'll close this bug in 7 calendar days with no response from Luxonis.
Closing stale bug, no response from Luxonis