Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in netopeer server-2 #100

Closed
shishirpandey29 opened this issue Oct 15, 2018 · 4 comments
Closed

Crash in netopeer server-2 #100

shishirpandey29 opened this issue Oct 15, 2018 · 4 comments

Comments

@shishirpandey29
Copy link

Hi ,
I observed crash in netopeer-server2 .
setup details :

  1. libnetconf2-0.11-r1
  2. Netopeer2-0.5-r1
  3. sysrepo-0.7.4/

backtrace :
gdb) bt
#0 0x00007f4a241a32b0 in nc_session_free (session=0x7f4a140033c0, data_free=0x407bff <free_ds>)
at /home/test/libnetconf2-0.11-r1/src/session.c:713
#1 0x0000000000408f60 in np2srv_del_session_clb (session=0x7f4a140033c0)
at /home/test/Netopeer2-0.5-r1/server/main.c:756
#2 0x000000000040a6b6 in worker_thread (arg=0x1bf8830)
at /home/test/Netopeer2-0.5-r1/server/main.c:1302
#3 0x00007f4a232d2e25 in start_thread () from /lib64/libpthread.so.0
#4 0x00007f4a2265734d in clone () from /lib64/libc.so.6

local struct info at time of crash
gdb) info locals
r = 1
i = 19999
rpc_locked = 1
sock = -1
connected = 1
multisession = 1
siter = 0x0

Analysis :
1)libnetconf2-0.11-r1 maintains circular linked list of netconf sessions over same ssh .

2)In issue , multiple netconf sessions were created over same ssh as multisession = 1. I think, two netconf session over same ssh.

3)At line number 706 in libnetconf2-0.11-r1/src/session.c, in case of there are two netconf sessions over same ssh, libnetconf2-0.11-r1 marks siter->ti.libssh.next = NULL;
At this step, netconf session list over same ssh is no more circular list.

4)At line number 713 in libnetconf2-0.11-r1/src/session.c, try to find out context of existed netconf session having status NC_STATUS_RUNNING for setting ssh call back, and while iterating over netconf session list , try to access siter->ti.libssh.next (made it NULL at line number 706) and crash occurred at siter->status != NC_STATUS_RUNNING at line number 713.

code :
libnetconf2-0.11-r1/src/session.c:
706 siter->ti.libssh.next = NULL;
707 } else {
708 /* there are still multiple sessions, keep the ring list /
709 siter->ti.libssh.next = session->ti.libssh.next;
710 }
711 /
change nc_sshcb_msg() argument, we need a RUNNING session and this one will be freed */
712 if (session->flags & NC_SESSION_SSH_MSG_CB) {
713 for (siter = session->ti.libssh.next; siter->status != NC_STATUS_RUNNING; siter = si ter->ti.libssh.next) {
714 if (siter->ti.libssh.next == session) {
715 ERRINT;
716 break;
717 }
718 }

Please check it once.

Regards
Shishir

@michalvasko
Copy link
Member

Hi Shishir,
seems like a duplicate of #92, should be fixed by e50b6b1. Please, do not create issues unless you encounter a problem on current devel or master branch.

Regards,
Michal

@achrc
Copy link

achrc commented Oct 19, 2018

Hi,

I have the same issue in the same versions of the code.
The above fix does not solve the issue.
In my case connected = 0.

Best Regards
Anne

@michalvasko
Copy link
Member

Hi Anne,
firstly, what same versions of the code? Unless you have the current version (libnetconf2 0.12.27) I will not help you with any issues.

Secondly, do you have the same stack trace as was posted here? Whether the session is connected or not should not matter. Most helpful would be if you could post the stack trace of all the threads after the crash.

Regards,
Michal

@achrc
Copy link

achrc commented Oct 19, 2018 via email

@michalvasko michalvasko closed this as not planned Won't fix, can't repro, duplicate, stale Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants