1. 前言说明
我们在JetPack 5.1的camera pipeline上遇到了一些问题。
正常运行了很长一段时间(多天),但它会突然得到以下错误。
log如下:
Oct 05 07:13:25 camera process[1032]: Module_id 30 Severity 2 : (fusa) Error: InvalidState Invalid Status index in:/capture/src/fusaViHandler.cpp 705
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: (propagating from src/services/capture/FusaCaptureViCsiHw.cpp, function waitCsiFrameEnd(), line 600)
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: (propagating from src/common/Utils.cpp, function workerThread(), line 114)
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: Worker thread ViCsiHw frameComplete failed (in src/common/Utils.cpp, function workerThread(), line 133)
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: (propagating from src/services/capture/FusaCaptureViCsiHw.cpp, function waitCsiFrameEnd(), line 600)
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: (propagating from src/common/Utils.cpp, function workerThread(), line 114)
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: Worker thread ViCsiHw frameComplete failed (in src/common/Utils.cpp, function workerThread(), line 133)
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: Timeout waiting on frame start sensor guid 3, capture sequence ID = -570929408 (in src/services/capture/FusaCaptureViCsiHw.cpp, funct>
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: (propagating from src/common/Utils.cpp, function workerThread(), line 114)
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: Worker thread ViCsiHw frameStart failed (in src/common/Utils.cpp, function workerThread(), line 133)
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: Timeout waiting on frame start sensor guid 0, capture sequence ID = -570928384 (in src/services/capture/FusaCaptureViCsiHw.cpp, funct>
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: (propagating from src/common/Utils.cpp, function workerThread(), line 114)
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: Worker thread ViCsiHw frameStart failed (in src/common/Utils.cpp, function workerThread(), line 133)
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: Timeout waiting on frame start sensor guid 2, capture sequence ID = -570928896 (in src/services/capture/FusaCaptureViCsiHw.cpp, funct>
Oct 05 07:13:25 camera process[1032]: double free or corruption (out)
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: (propagating from src/services/capture/FusaCaptureViCsiHw.cpp, function waitCsiFrameEnd(), line 600)
Oct 05 07:13:25 camera process[1032]: Module_id 30 Severity 2 : (fusa) Error: InvalidState Invalid Status index in:/capture/src/fusaViHandler.cpp 705
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: Timeout waiting on frame start sensor guid 1, capture sequence ID = -570928640 (in src/services/capture/FusaCaptureViCsiHw.cpp, funct>
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: (propagating from src/common/Utils.cpp, function workerThread(), line 114)
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: Worker thread ViCsiHw frameStart failed (in src/common/Utils.cpp, function workerThread(), line 133)
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: (propagating from src/common/Utils.cpp, function workerThread(), line 114)
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: Worker thread ViCsiHw frameComplete failed (in src/common/Utils.cpp, function workerThread(), line 133)
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: (propagating from src/common/Utils.cpp, function workerThread(), line 114)
Oct 05 07:13:25 camera process[1032]: SCF: Error InvalidState: Worker thread ViCsiHw frameStart failed (in src/common/Utils.cpp, function workerThread(), line 133)
我用AddressSanitizer构建了我们的软件,得到了以下错误。
这可能与libvargus .so中的内存损坏有关。
调试信息如下:
=================================================================
==19750==ERROR: AddressSanitizer: negative-size-param: (size=-6)
#0 0xffffb5994f93 in memmove (/lib/aarch64-linux-gnu/libasan.so.4+0x75f93)
#1 0xaaaad8c03a2b in std::char_traits::move(char*, char const*, unsigned long) /usr/aarch64-linux-gnu/include/c++/7/bits/char_traits.h:342
#2 0xaaaad8c0c703 in std::__cxx11::basic_string, std::allocator >::_S_move(char*, char const*, unsigned long) /usr/aarch64-linux-gnu/include/c++/7/bits/basic_string.h:349
#3 0xaaaad8c09adb in std::__cxx11::basic_string, std::allocator >::_M_replace(unsigned long, unsigned long, char const*, unsigned long) /usr/aarch64-linux-gnu/include/c++/7/bits/basic_string.tcc:438
#4 0xffff2a935d8f (/usr/lib/aarch64-linux-gnu/tegra/libnvargus.so+0x7ad8f)
#5 0xffff2a961697 (/usr/lib/aarch64-linux-gnu/tegra/libnvargus.so+0xa6697)
#6 0xffff2a96317f (/usr/lib/aarch64-linux-gnu/tegra/libnvargus.so+0xa817f)
#7 0xffff2a9486cb (/usr/lib/aarch64-linux-gnu/tegra/libnvargus.so+0x8d6cb)
#8 0xffff2a282f17 (/usr/lib/aarch64-linux-gnu/tegra/libnvscf.so+0x145f17)
#9 0xffff2a2833cb (/usr/lib/aarch64-linux-gnu/tegra/libnvscf.so+0x1463cb)
#10 0xffff2a2838cf (/usr/lib/aarch64-linux-gnu/tegra/libnvscf.so+0x1468cf)
#11 0xffff2a1acd5b (/usr/lib/aarch64-linux-gnu/tegra/libnvscf.so+0x6fd5b)
#12 0xffff2a1d744f (/usr/lib/aarch64-linux-gnu/tegra/libnvscf.so+0x9a44f)
#13 0xffff2a1eef2b (/usr/lib/aarch64-linux-gnu/tegra/libnvscf.so+0xb1f2b)
#14 0xffff2a1bddff (/usr/lib/aarch64-linux-gnu/tegra/libnvscf.so+0x80dff)
#15 0xffff2a1bdf8b (/usr/lib/aarch64-linux-gnu/tegra/libnvscf.so+0x80f8b)
#16 0xffff2a1bc9b7 (/usr/lib/aarch64-linux-gnu/tegra/libnvscf.so+0x7f9b7)
#17 0xffffb249b113 (/usr/lib/aarch64-linux-gnu/tegra/libnvos.so+0x9113)
#18 0xffffb58f5623 in start_thread (/lib/aarch64-linux-gnu/libpthread.so.0+0x7623)
#19 0xffffb520d49b (/lib/aarch64-linux-gnu/libc.so.6+0xd149b)
0xfffeb533080b is located 27 bytes inside of 31-byte region [0xfffeb53307f0,0xfffeb533080f)
allocated by thread T47 here:
#0 0xffffb59f22eb in operator new(unsigned long) (/lib/aarch64-linux-gnu/libasan.so.4+0xd32eb)
#1 0xaaaad8c0ca5f in __gnu_cxx::new_allocator::allocate(unsigned long, void const*) /usr/aarch64-linux-gnu/include/c++/7/ext/new_allocator.h:111
#2 0xaaaad8c09f33 in std::allocator_traits >::allocate(std::allocator&, unsigned long) /usr/aarch64-linux-gnu/include/c++/7/bits/alloc_traits.h:436
#3 0xaaaad8c0b4cb in std::__cxx11::basic_string, std::allocator >::_M_create(unsigned long&, unsigned long) /usr/aarch64-linux-gnu/include/c++/7/bits/basic_string.tcc:153
#4 0xaaaad8c0c84f in std::__cxx11::basic_string, std::allocator >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long) /usr/aarch64-linux-gnu/include/c++/7/bits/basic_string.tcc:317
#5 0xaaaad8c09c6b in std::__cxx11::basic_string, std::allocator >::_M_replace(unsigned long, unsigned long, char const*, unsigned long) /usr/aarch64-linux-gnu/include/c++/7/bits/basic_string.tcc:466
#6 0xffff2a935d8f (/usr/lib/aarch64-linux-gnu/tegra/libnvargus.so+0x7ad8f)
#7 0xffffb520d49b (/lib/aarch64-linux-gnu/libc.so.6+0xd149b)
Thread T47 created by T39 (argus_thread) here:
#0 0xffffb5958857 in __interceptor_pthread_create (/lib/aarch64-linux-gnu/libasan.so.4+0x39857)
#1 0xffffb249b3ff (/usr/lib/aarch64-linux-gnu/tegra/libnvos.so+0x93ff)
#2 0xffff6664e4db in argus_thread /home/user/src/nvidia-gstreamer/src/gstarguscamerasrc/gstarguscamerasrc.cpp:977
#3 0xffffb5784483 (/lib/aarch64-linux-gnu/libglib-2.0.so.0+0x7b483)
#4 0xffffb58f5623 in start_thread (/lib/aarch64-linux-gnu/libpthread.so.0+0x7623)
#5 0xffffb520d49b (/lib/aarch64-linux-gnu/libc.so.6+0xd149b)
Thread T39 (argus_thread) created by T37 (arguscamera) here:
#0 0xffffb5958857 in __interceptor_pthread_create (/lib/aarch64-linux-gnu/libasan.so.4+0x39857)
#1 0xffffb57a92e7 (/lib/aarch64-linux-gnu/libglib-2.0.so.0+0xa02e7)
#2 0xffffb57848ef in g_thread_new (/lib/aarch64-linux-gnu/libglib-2.0.so.0+0x7b8ef)
#3 0xffff6664e047 in gst_nv_argus_camera_set_caps /home/user/src/nvidia-gstreamer/src/gstarguscamerasrc/gstarguscamerasrc.cpp:864
#4 0xffffb4ecc71f in gst_base_src_set_caps (/lib/aarch64-linux-gnu/libgstbase-1.0.so.0+0x3f71f)
#5 0xffffb4eccc73 (/lib/aarch64-linux-gnu/libgstbase-1.0.so.0+0x3fc73)
#6 0xffffb4eca5d3 (/lib/aarch64-linux-gnu/libgstbase-1.0.so.0+0x3d5d3)
#7 0xffffb566370f (/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0+0xc870f)
#8 0xffffb5784483 (/lib/aarch64-linux-gnu/libglib-2.0.so.0+0x7b483)
#9 0xffffb58f5623 in start_thread (/lib/aarch64-linux-gnu/libpthread.so.0+0x7623)
#10 0xffffb520d49b (/lib/aarch64-linux-gnu/libc.so.6+0xd149b)
Thread T37 (arguscamera) created by T0 here:
#0 0xffffb5958857 in __interceptor_pthread_create (/lib/aarch64-linux-gnu/libasan.so.4+0x39857)
#1 0xffffb57a92e7 (/lib/aarch64-linux-gnu/libglib-2.0.so.0+0xa02e7)
#2 0xffffb5785123 (/lib/aarch64-linux-gnu/libglib-2.0.so.0+0x7c123)
#3 0xffffb5785563 in g_thread_pool_push (/lib/aarch64-linux-gnu/libglib-2.0.so.0+0x7c563)
#4 0xffffb5664777 (/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0+0xc9777)
#5 0xffffb4ecd01b in gst_base_src_start_complete (/lib/aarch64-linux-gnu/libgstbase-1.0.so.0+0x4001b)
#6 0xffffb4ecd34f (/lib/aarch64-linux-gnu/libgstbase-1.0.so.0+0x4034f)
#7 0xffffb4ecd877 (/lib/aarch64-linux-gnu/libgstbase-1.0.so.0+0x40877)
#8 0xffffb5627b2b (/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0+0x8cb2b)
#9 0xffffb5602ddb in gst_element_change_state (/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0+0x67ddb)
SUMMARY: AddressSanitizer: negative-size-param (/lib/aarch64-linux-gnu/libasan.so.4+0x75f93) in memmove
==19750==ABORTING
2. 查阅资料
Nvidia Jetson最近解决了libvargus中的内存损坏问题。
可以换到最新的Jetpack发布版本,即Jetpack-5.1.2/ l4t-r35.4.1
同时更新预构建的二进制libvargus.so,用如下附近
https://download.csdn.net/download/jzwjzw19900922/88557361
3. 测试
经过测试,更新版本可解决上述 内存损坏问题