libnetconf2
libnetconf2 copied to clipboard
Handling close session
Hi Michal,
After logging in to a netconf session via MGsoft client ,i am trying to disconnect the session. As a part of session disconnect i get NC_PSPOLL_SESSION_TERM as return value to nc_ps_poll on which i do the cleanup handling of my database and i call nc_ps_del_session and nc_session_free Api's.
Now again try to login.However after the 2nd login none of the get/get-config,etc cbs gets invoked in nc_ps_poll. I enabled the libnetconf2 logs and found on the 2nd login i get the below msg:-
DEBUG: Session 2: received message:
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<capabilities>
<capability>urn:ietf:params:netconf:base:1.1</capability>
<capability>urn:ietf:params:netconf:base:1.0</capability>
</capabilities>
</hello>
However on the 1st login i got the below mssg :-
DEBUG: Session 1: received message:
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<capabilities>
<capability>urn:ietf:params:netconf:base:1.1</capability>
<capability>urn:ietf:params:netconf:base:1.0</capability>
</capabilities>
</hello>
[2018/12/14 08:56:38.320697, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket
I can see the mssg "ssh_socket_unbuffered_write: Enabling POLLOUT for socket" does not come for the 2nd time when i logged in .Which i assume is leading to the user cbs not getting invoked in nc_ps_poll. Am i missing any thing as a part of session clean up of 1st session.May i know what can be the reason for the 2nd session to not work?
Thanks, Vivek prasad
Hi Vivek, I would not come to any conclusions based on SSH messages, they are most likely not relevant. And based on these message I am unable to help you. Again, look into netopeer2-server, everything works there.
Regards, Michal
Hi Michal , I think the issue is with accepting multiple parallel session. I tried launching 3-4 session parallely and i can see it gets stuck on the 3rd /4th session i.e, the netconf server is not able to send a hello mssg back to the client and it gets stuck on nc_accept().
I further tried copying the neetoper server code in my server.cpp .I am calling worker_thread as a part of my main thread.And i can see if i try to login one session and logout and do this operation multiple times then no issue is seen. However if i launch the 2nd session keeping 1st session present,then the 2nd session is not able to send a hello mssg back to client and it gets stuck.Similar issue i face with my implementation of spawning multiple worker threads for each session.
I am attaching full logs by enabling ssh and libnetconf2 to level 3. I am not able to get further what exactly is going wrong inside the libnetconf2 code.Can you please suggest some steps to proceed further .Please let me know in any other info is required?
Thanks, Vivek Prasad
Hi Vivek,
there is nothing interesting in the log so I cannot help your with your server. However, we have not really tested creating that many session simultaneously so it is possible there is a problem in libnetconf2. What exactly did you try to do, spawn several threads that all call nc_connect*()
?
Regards, Michal
Hi Michal,
I am not using libnetconf2 client.however i am using MgSoft browser to login multiple sessions parallely. I am trying to see if i can find some more thing. Do u suggest any specific logs to be enabled before doing the test. Currently i am setting libyang and libnetconf2 log levels to 3.
Thanks, Vivek Prasad
Hi Vivek, I do not think any logs will help you in this case.
Regards, Michal