Hi :)
I am getting segmentation fault when I run a decoder inside a child process.
This only happens when I run the decoder in the child process. Without fork() the application works as expected.
Jetson AGX Xavier. L4T 32.5.1-20210519111140
Small example to reproduce the failure: NvFaultEx.zip (1.2 KB)
Backtrace:
Program received signal SIGSEGV, Segmentation fault.
tcache_get (tc_idx=2) at malloc.c:2952
2952 malloc.c: No such file or directory.
(gdb) bt
#0 tcache_get (tc_idx=2) at malloc.c:2952
#1 __GI___libc_malloc (bytes=bytes@entry=50) at malloc.c:3060
#2 0x0000007f84666584 in _dl_new_object (realname=0x5582330900 "/usr/lib/aarch64-linux-gnu/tegra/libnvmm_utils.so", realname@entry=0x7f83dbec60 "", libname=0x558234f7c0 "",
libname@entry=0x7f84667cb8 <openaux> "\375{\276\251\375\003", type=type@entry=0, loader=<optimized out>, loader@entry=0x558234f7c0, mode=mode@entry=-2147483648, nsid=nsid@entry=0) at dl-object.c:163
#3 0x0000007f846613bc in _dl_map_object_from_fd (name=0x7f84667cb8 <openaux> "\375{\276\251\375\003", name@entry=0x7f83dbf1b7 "libnvmm_utils.so", origname=origname@entry=0x0, fd=<optimized out>,
fbp=fbp@entry=0x7fe6303a68, realname=0x7f83dbec60 "", loader=loader@entry=0x558234f7c0, l_type=0, l_type@entry=2, mode=mode@entry=-2147483648, stack_endp=0x7fe6303a60, stack_endp@entry=0x7fe6303b00,
nsid=nsid@entry=0) at dl-load.c:998
#4 0x0000007f84663c68 in _dl_map_object (loader=0x558234f7c0, name=0x7f83dbf1b7 "libnvmm_utils.so", type=2, trace_mode=0, mode=-2147483648, nsid=0) at dl-load.c:2461
#5 0x0000007f84667cf0 in openaux (a=0x7fe63041e8) at dl-deps.c:63
#6 0x0000007f8424a694 in __GI__dl_catch_exception (exception=0x7f83dbf1b7, exception@entry=0x7f8466e5b4 <_dl_close_worker+1324>, operate=0x7fe6303e1c, operate@entry=0x7f84667cb8 <openaux>, args=0x7fe63041d0,
args@entry=0x7fe6304450) at dl-error-skeleton.c:196
#7 0x0000007f84668060 in _dl_map_object_deps (map=map@entry=0x558234f7c0, preloads=preloads@entry=0x0, npreloads=npreloads@entry=0, trace_mode=trace_mode@entry=0, open_mode=<optimized out>) at dl-deps.c:249
#8 0x0000007f8466d8d0 in dl_open_worker (a=0x7fe63044d8) at dl-open.c:278
#9 0x0000007f8424a694 in __GI__dl_catch_exception (exception=0xfffffffffffffffe, exception@entry=0x7fe63044c0, operate=0x7fe63042fc, operate@entry=0x7f8466d7e0 <dl_open_worker>, args=0x7fe63044c0,
args@entry=0x7fe63044d8) at dl-error-skeleton.c:196
#10 0x0000007f8466d420 in _dl_open (file=0x558234f720 "/usr/lib/aarch64-linux-gnu/libv4l/plugins/nv/libv4l2_nvvidconv.so", mode=-2147483647, caller_dlopen=0x7f844dea68, nsid=-2, argc=1, argv=0x7fe6304f98,
env=<optimized out>) at dl-open.c:605
#11 0x0000007f83ff1014 in dlopen_doit (a=0x7fe6304798) at dlopen.c:66
#12 0x0000007f8424a694 in __GI__dl_catch_exception (exception=0x7f846897a8 <__stack_chk_guard>, exception@entry=0x7fe6304730, operate=0x7fe630458c, operate@entry=0x7f83ff0fb0 <dlopen_doit>, args=0x7fe6304710,
args@entry=0x7fe6304798) at dl-error-skeleton.c:196
#13 0x0000007f8424a738 in __GI__dl_catch_error (objname=objname@entry=0x5582303270, errstring=errstring@entry=0x5582303278, mallocedp=mallocedp@entry=0x5582303268, operate=operate@entry=0x7f83ff0fb0 <dlopen_doit>,
args=args@entry=0x7fe6304798) at dl-error-skeleton.c:215
#14 0x0000007f83ff2780 in _dlerror_run (operate=operate@entry=0x7f83ff0fb0 <dlopen_doit>, args=0x7fe6304798, args@entry=0x7fe63047a8) at dlerror.c:162
--Type <RET> for more, q to quit, c to continue without paging--c
#15 0x0000007f83ff10e8 in __dlopen (file=<optimized out>, mode=<optimized out>) at dlopen.c:87
#16 0x0000007f844dea68 in ?? () from /usr/lib/aarch64-linux-gnu/tegra/libv4l2.so.0
#17 0x0000007f844da6c0 in v4l2_fd_open () from /usr/lib/aarch64-linux-gnu/tegra/libv4l2.so.0
#18 0x0000007f844dae24 in v4l2_open () from /usr/lib/aarch64-linux-gnu/tegra/libv4l2.so.0
#19 0x000000556b3c870c in NvV4l2Element::NvV4l2Element(char const*, char const*, int, int) ()
#20 0x000000556b3d3478 in NvVideoDecoder::NvVideoDecoder(char const*, int) ()
#21 0x000000556b3d34c4 in NvVideoDecoder::createVideoDecoder(char const*, int) ()
#22 0x000000556b3c3818 in main ()
P.S. Note: libv4l2_nvargus.so was moved to avoid malloc-delete mismatch error as suggested here Memory Leak (Alloc/free mismatch) in Tegra multimedia API (encoder) - #6 by DaneLLL