On Ubuntu 22, using the latest CUDA 12 SDK, when attempting to run any samples or my own software (which works fine on Windows) written in Python, when calling sl.Camera.get_device_list(), python immediately seg faults with the following stack trace:
Thread 1 "python" received signal SIGSEGV, Segmentation fault.
__strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:74
74 ../sysdeps/x86_64/multiarch/strlen-avx2.S: No such file or directory.
(gdb) bt
#0 __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:74
#1 0x00007ffff7631149 in __pyx_pw_5pyzed_2sl_6Camera_147get_device_list(_object*, _object* const*, long, _object*) () from /home/breakfast/dev/zed-performance-tester/env/lib/python3.10/site-packages/pyzed/sl.cpython-310-x86_64-linux-gnu.so
#2 0x00005555556a28a2 in _PyEval_EvalFrameDefault ()
#3 0x00005555556b470c in _PyFunction_Vectorcall ()
#4 0x000055555569ce0d in _PyEval_EvalFrameDefault ()
#5 0x000055555578de56 in ?? ()
#6 0x000055555578dcf6 in PyEval_EvalCode ()
#7 0x00005555557b87d8 in ?? ()
#8 0x00005555557b20bb in ?? ()
#9 0x00005555557b8525 in ?? ()
#10 0x00005555557b7a08 in _PyRun_SimpleFileObject ()
#11 0x00005555557b7653 in _PyRun_AnyFileObject ()
#12 0x00005555557aa41e in Py_RunMain ()
#13 0x0000555555780cad in Py_BytesMain ()
#14 0x00007ffff7c75d90 in __libc_start_call_main (main=main@entry=0x555555780c70, argc=argc@entry=2, argv=argv@entry=0x7fffffffe3b8) at ../sysdeps/nptl/libc_start_call_main.h:58
#15 0x00007ffff7c75e40 in __libc_start_main_impl (main=0x555555780c70, argc=2, argv=0x7fffffffe3b8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe3a8) at ../csu/libc-start.c:392
#16 0x0000555555780ba5 in _start ()
What version of the ZED SDK are you using? Please verify that you are using version 4.0.7, and you can also make sure that the python wrapper is up to date by running the command in your python environment:
First, the C++ SDK was not experiencing this issue, however, I noticed when running the ZED_Multi_Camera C++ example, it was failing to detect one of the cameras:
$ ./ZED_Multi_Camera
ID : 0 ,model : ZED 2i , S/N : 30469917 , state : AVAILABLE
ID : -1 ,model : ZED 2i , S/N : 0 , state : NOT AVAILABLE
2 ZED Detected
ZED 2i, ID: 0, SN: 30469917 Opened
ZED ID:1 Error: CAMERA NOT DETECTED
I’ve seen this behavior before on Windows systems too but I don’t know what triggers it.
Anyways, I unplugged and replugged every camera to reboot them, and the C++ example was then able to detect both cameras.
After doing that, the Python examples started working without seg faulting.
So it seems like there is a bug in the Python SDK where a strlen call causes a seg fault in whatever situation happens where there is an error detecting one of the cameras (when its ID returns -1). Probably some nullptr string or something getting passed around somewhere on the C side.
As an aside, I noticed on Windows systems that when the cameras are in this undetectable state, sometimes Python apps will simply silently exit on the Camera.get_device_list() call, and now I’m starting to wonder if that’s just a different manifestation of the same Python SDK bug that’s crashing the Ubuntu SDK.
Thanks for the valuable info. We will look into this to reproduce and find where the code segfaults.
Alternatively, if you experience more issues where the camera returns CAMERA_NOT_DETECTED, you can use the static method sl::reboot and provide a serial number to hard reboot a specific camera without unplugging it.