Menu

#3357 ntf: ntfa coredump when use saNtfFinalize api

5.25.04
fixed
None
defect
ntf
lib
major
False
2025-04-26
2024-08-07
No
Program terminated with signal SIGSEGV, Segmentation fault.
#0  ntfa_hdl_rec_del (list_head=list_head@entry=0x7efeee5f03e8 <ntfa_cb+40>, rm_node=rm_node@entry=0x7efe74008800)
    at src/ntf/agent/ntfa_util.c:1131
1131    src/ntf/agent/ntfa_util.c: No such file or directory.
[Current thread is 1 (Thread 0x7efe817fa700 (LWP 1673))]
(gdb) bt
#0  ntfa_hdl_rec_del (list_head=list_head@entry=0x7efeee5f03e8 <ntfa_cb+40>, rm_node=rm_node@entry=0x7efe74008800)
    at src/ntf/agent/ntfa_util.c:1131
#1  0x00007efeee5e02f5 in saNtfFinalize (ntfHandle=4276092932) at src/ntf/agent/ntfa_api.c:1802
#2  0x000055c9afd8b36e in std::function<SaAisErrorT (unsigned long long)>::operator()(unsigned long long) const (
    __args#0=4276092932, this=0x7efe817f9de0) at /usr/include/c++/10/bits/std_function.h:617
#3  ais::Decorator<SaAisErrorT (unsigned long long), ais::DefaultRetryPolicy>::operator()(unsigned long long) (args#0=4276092932, 
    this=0x7efe817f9de0) at ./src/ais/try_again_decorator.h:86
#4  NtfTest::saNtfFinalize (handle=4276092932) at ./src/ntf/apitest/ntf_api_with_try_again.h:31
#5  0x000055c9afd8bfc8 in sendNotify (arg=<optimized out>) at src/ntf/apitest/tet_saNtfFinalize.cc:181
#6  0x00007efeee2bb609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#7  0x00007efeee1e0353 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
[Current thread is 1 (Thread 0x7f1462e65700 (LWP 7429))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007f15b0e3a859 in __GI_abort () at abort.c:79
#2  0x00007f15b0ea526e in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7f15b0fcf298 "%s\n")
    at ../sysdeps/posix/libc_fatal.c:155
#3  0x00007f15b0ead2fc in malloc_printerr (str=str@entry=0x7f15b0fd1628 "double free or corruption (fasttop)") at malloc.c:5347
#4  0x00007f15b0eaec65 in _int_free (av=0x7f1554000020, p=0x7f15540086f0, have_lock=have_lock@entry=0) at malloc.c:4266
#5  0x00007f15b0eb288d in __GI___libc_free (mem=0x7f1554008700) at malloc.c:3125
#6  tcache_thread_shutdown () at malloc.c:2964
#7  __malloc_arena_thread_freeres () at arena.c:951
#8  0x00007f15b0eb70a0 in __libc_thread_freeres () at thread-freeres.c:38
#9  0x00007f15b101262f in start_thread (arg=<optimized out>) at pthread_create.c:491
#10 0x00007f15b0f37353 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Step Reproduce:
step 1:
Start multiple thread and handle:
- saNtfFinalize
- random delay
- saNtfFinalize
Step 2: this step makes easier reproduce the issue
Pause NTFD process
sleep 1s
Resume NTFD process
Step 3:
Wait for all thread done

Related

Wiki: ChangeLog-5.25.04

Discussion

  • Thien Minh Huynh

    • status: accepted --> review
     
  • Thien Minh Huynh

    • status: review --> fixed
     
  • Thien Minh Huynh

    commit 7edd13a68302344a5e552e9e28c04c7a882fe684 (HEAD -> develop, origin/develop, ticket-3357)
    Author: thien.m.huynh thien.m.huynh@endava.com
    Date: Wed Aug 14 14:10:45 2024 +0700

    ntf: test case to test manage ntfa resource [#3357]
    

    commit 862493e85ee889bbb0d2369e357d9360214bc39f
    Author: thien.m.huynh thien.m.huynh@endava.com
    Date: Wed Aug 14 14:04:18 2024 +0700

    ntf: fix thread unsafe [#3357]
    
    In case finalize get the head pointer before mutex lock.
    That leads to the iterator operation corrupt.
    
    This fix is to take a mutex lock before get head pointer
    
     
  • Gary Lee

    Gary Lee - 2025-04-26
    • Milestone: 5.25.03 --> 5.25.04
     

Log in to post a comment.

MongoDB Logo MongoDB