Segfault when reopening the camera after disconnection

Hello there,

We are currently facing a nasty segfault when we try to open the camera again when someone has unplugged it and plugged it again. The first time the camera opens with no problems but the second time it always throws a seg fault. This is the current output:

#0  0x0000ffffeb1b0ad0 in  () at /lib/aarch64-linux-gnu/libnvinfer.so.8
#1  0x0000ffffeb1b0c7c in  () at /lib/aarch64-linux-gnu/libnvinfer.so.8
#2  0x0000ffffeb1b214c in  () at /lib/aarch64-linux-gnu/libnvinfer.so.8
#3  0x0000ffff91e4e0a0 in  () at /lib/aarch64-linux-gnu/libnvinfer_plugin.so.8
#4  0x0000fffff7fc7624 in call_init (env=0xaaaaac45c6a0, argv=0xffffffffe7a8, argc=1, l=<optimized out>) at ./elf/dl-init.c:70
#5  call_init (l=<optimized out>, argc=1, argv=0xffffffffe7a8, env=0xaaaaac45c6a0) at ./elf/dl-init.c:26
#6  0x0000fffff7fc772c in _dl_init (main_map=0xaaaaad98b2d0, argc=1, argv=0xffffffffe7a8, env=0xaaaaac45c6a0) at ./elf/dl-init.c:117
#7  0x0000ffffe3bed360 in __GI__dl_catch_exception (exception=0x0, operate=0xfffff7fcdd20 <call_dl_init>, args=0xffffffffab50) at ./elf/dl-error-skeleton.c:182
#8  0x0000fffff7fcdf5c in dl_open_worker (a=a@entry=0xffffffffad98) at ./elf/dl-open.c:808
#9  0x0000ffffe3bed308 in __GI__dl_catch_exception (exception=0xffffffffad80, operate=0xfffff7fcdeb4 <dl_open_worker>, args=0xffffffffad98)
    at ./elf/dl-error-skeleton.c:208
#10 0x0000fffff7fce2fc in _dl_open
    (file=0xaaaab11a0fb0 "/usr/local/zed/lib/libsl_ai.so", mode=-2147483646, caller_dlopen=0xffffe7634850 <ai::AILoader::loadLib(std::vector<ai::AI_LIB, std::allocator<ai::AI_LIB> >, int)+1872>, nsid=-2, argc=1, argv=0xffffffffe7a8, env=0xaaaaac45c6a0) at ./elf/dl-open.c:883
#11 0x0000ffffe3b396e4 in dlopen_doit (a=a@entry=0xffffffffb088) at ./dlfcn/dlopen.c:56
#12 0x0000ffffe3bed308 in __GI__dl_catch_exception (exception=exception@entry=0xffffffffafe0, operate=0xffffe3b39680 <dlopen_doit>, args=0xffffffffb088)
    at ./elf/dl-error-skeleton.c:208
#13 0x0000ffffe3bed3d0 in __GI__dl_catch_error
    (objname=0xffffffffb058, errstring=0xffffffffb060, mallocedp=0xffffffffb057, operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:227
#14 0x0000ffffe3b391c0 in _dlerror_run (operate=operate@entry=0xffffe3b39680 <dlopen_doit>, args=args@entry=0xffffffffb088) at ./dlfcn/dlerror.c:138
#15 0x0000ffffe3b39784 in dlopen_implementation (dl_caller=<optimized out>, mode=<optimized out>, file=<optimized out>) at ./dlfcn/dlopen.c:71
#16 ___dlopen (file=<optimized out>, mode=<optimized out>) at ./dlfcn/dlopen.c:81
#17 0x0000ffffe7634850 in ai::AILoader::loadLib(std::vector<ai::AI_LIB, std::allocator<ai::AI_LIB> >, int) () at /usr/local/zed/lib/libsl_zed.so
--Type <RET> for more, q to quit, c to continue without paging--
#18 0x0000ffffe763af64 in ai::AILoader::loadLib(ai::AI_LIB, int) () at /usr/local/zed/lib/libsl_zed.so
#19 0x0000ffffe7527824 in sl_disp::NeuralDisparityCore::setUp(sl_disp::DISPARITY, ip::xM2Lk1Heg5897Y*, int, int, int, sl::Mat&, sl::Mat&, sl::Mat&, int, float, float, float, float, float, CUstream_st*, PerformanceMeasurer*, int) () at /usr/local/zed/lib/libsl_zed.so
#20 0x0000ffffe791cac8 in sl::Camera::open(sl::InitParameters) () at /usr/local/zed/lib/libsl_zed.so

System information:

  • ZED SDK 4.2.1
  • Neural Depth
  • This has been reported both on Jetson Orin NX and Jetson Xavier NX
  • C++ SDK

Hi @arremebg
do you correctly call the close command when the application ends?

Hi there! Before init, if camera is already opened, we call this two lines of code:

cudaDeviceSynchronize();
                    zed->close();

Hi, could you share more information about the program you are using? Maybe sharing a minimal reproducible example and some details. Is this behavior kinda random or easy to replicate? Thanks

Hey! I will try to make a minimal example, but I’m afraid it’s something environment wise… On PC the program works as expected but on Jetson we are having this weird crash :melting_face: