CESNET / libnetconf

C NETCONF library
Other
113 stars 84 forks source link

freeing of global variable "server_capabilities" leads to SIGABRT #165

Closed BanuPrakashReddy closed 8 years ago

BanuPrakashReddy commented 8 years ago

Hi,

I feel "server_capabilities" should be made thread specific similar to what have been done to variable "rpc2all_data". Otherwise, in error scenarios where there are multiple sessions double free of this variable leads to crash.

I do not know how to reproduce the crash again. I got this randomly while playing with multiple sessions. So, Below I have pasted gdb back trace(NOTE: line numbers are not in sync with code you have).

--------------------------------------------------------------------------------
Core was generated by `/usr/bin/netopeer-server -d -v 3'.
Program terminated with signal SIGABRT, Aborted.
#0  0x75e4a9b8 in ?? ()
warning: exec file is newer than core file.
warning: Error reading shared library list entry at 0xb34378
warning: Error reading shared library list entry at 0xb34378
Traceback (most recent call last):
  File "../uclibc/target/usr/lib/libstdc++.so.6.0.19-gdb.py", line 59, in ?
    from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named libstdcxx.v6.printers
(gdb) bt
#0  0x75e4a9b8 in raise () from ../uclibc/target/lib/libc.so.6
#1  0x75e4c360 in abort () from ../uclibc/target/lib/libc.so.6
#2  0x75e8c9b8 in __libc_message () from ../uclibc/target/lib/libc.so.6
#3  0x75e945b8 in malloc_printerr () from ../uclibc/target/lib/libc.so.6
#4  0x75e95840 in _int_free () from ../uclibc/target/lib/libc.so.6
#5  0x770a0a58 in ncds_apply_rpc2all (session=0x7530c330, rpc=0x75309930, ids=0x0) at src/datastore.c:6649
#6  0x76c0d604 in np_ssh_client_netconf_rpc (client=0x310b700) at src/ssh/server_ssh.c:595
#7  0x76c03c94 in client_main_thread (arg=0x310b700) at src/server.c:245
#8  0x75fa1fec in start_thread () from ../uclibc/target/lib/libpthread.so.0
#9  0x75f087bc in __thread_start () from ../uclibc/target/lib/libc.so.6
---------------------------------------------------------------------------------------------------

Here, datastore.c:6649 above points to datastore.c:6608 line in opensource.

Thanks, Banu Prakash

michalvasko commented 8 years ago

Hi Banu, it should work now.

Regards, Michal