luxonis / depthai-python

DepthAI Python Library
MIT License
359 stars 193 forks source link

Unable to run OAK-1 and OAK-D Lite code simultaneously on separate threads #491

Open jonathandao0 opened 2 years ago

jonathandao0 commented 2 years ago

I’m trying to run Python code that runs an OAK-1 and an OAK-D Lite on two threads in parallel. When running the threads individually, the code runs fine, but when I try to run both at the same time, I’m getting a stack trace that isn't very clear:

Stack trace (most recent call last):
#31   Object "", at 00007FFD98888484, in PyEval_EvalFrameDefault
#30   Object "", at 00007FFD9887B841, in PyArg_UnpackStack
#29   Object "", at 00007FFE0C327B4E, in PyInit_pydevd_frame_evaluator_win32_37_64
#28   Object "", at 00007FFD9888AAC6, in PyEval_EvalFrameDefault
#27   Object "", at 00007FFD988B19F3, in PyUnicode_RPartition
#26   Object "", at 00007FFD9887B294, in PyFunction_FastCallDict
#25   Object "", at 00007FFE0C327B4E, in PyInit_pydevd_frame_evaluator_win32_37_64
#24   Object "", at 00007FFD98888608, in PyEval_EvalFrameDefault
#23   Object "", at 00007FFD988732B8, in PyType_Lookup
#22   Object "", at 00007FFE0C327B4E, in PyInit_pydevd_frame_evaluator_win32_37_64
#21   Object "", at 00007FFD988892C8, in PyEval_EvalFrameDefault
#20   Object "", at 00007FFD9887B98B, in PyArg_UnpackStack
#19   Object "", at 00007FFD9887D006, in PyObject_FastCallKeywords
#18   Object "", at 00007FFD97936512, in pybind11::error_already_set::error_already_set
#17   Object "", at 00007FFD9887D277, in PyObject_FastCallKeywords
#16   Object "", at 00007FFD988F1CF7, in PyErr_NoMemory
#15   Object "", at 00007FFD9889BCF9, in PyObject_Call
#14   Object "", at 00007FFD988F1EBF, in PyErr_NoMemory
#13   Object "", at 00007FFD98990CE6, in PyCFunction_FastCallDict
#12   Object "", at 00007FFD988754F3, in PyMethodDef_RawFastCallDict
#11   Object "", at 00007FFD9793A12B, in pybind11::error_already_set::error_already_set
#10   Object "", at 00007FFD9796B7C4, in PyInit_depthai
#9    Object "", at 00007FFD9796B6F9, in PyInit_depthai
#8    Object "", at 00007FFD97AC9471, in PyInit_depthai
#7    Object "", at 00007FFD97AADA35, in PyInit_depthai
#6    Object "", at 00007FFD97ABE046, in PyInit_depthai
#5    Object "", at 00007FFD97A97016, in PyInit_depthai
#4    Object "", at 00007FFD97A9A07B, in PyInit_depthai
#3    Object "", at 00007FFD97B266B7, in PyInit_depthai
#2    Object "", at 00007FFD97B29FD9, in PyInit_depthai
#1    Object "", at 00007FFD97B2A42E, in PyInit_depthai
#0    Object "", at 00007FFD97B32F9B, in PyInit_depthai

I originally thought this might be due to not being able to provide enough power, but using the Y-Power Adaptor doesn’t resolve the issue. Swapping the OAK-D Lite to an original OAK-D also shows the same error. I'm currently running with DepthAI v2.14.1.0.

themarpe commented 2 years ago

@jonathandao0 thanks for the report - we are looking into this at the moment and we hope to resolve this ASAP. Will update you about the progress

themarpe commented 2 years ago

@jonathandao0 Please try out either latest develop branch: (will soon be released as 2.15.0)

python3 -m pip install --extra-index-url https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local depthai==2.14.1.0.dev+3d1934628542ba80869555436b9f80424a8ee4b3

Also if you are on RPi, make sure your libc6 package is up to date:

sudo apt update
sudo apt install libc6 libc-bin

Let me know how that works for you.