You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our software sometimes sends a request-logout-user command whose name also matches the active session: "$client->send_and_recv_rpc('our-name');" But the send_and_recv_rpm call never returns in that case. In older NET::NETCONF versions it caused the script to exit with an error message about losing connection, which is the desired behavior. Looking at the code, I expect it would also get stuck if the session spontaneously died for other reasons, like idle timeout.
Looking in the NET::NETCONF code, I traced this problem to 2 causes. One already appears to be addressed in #31 "adding exception handling for reads and writes". The other though is that poll() never returns when the session dies in this case. Poll() is calling libssh2_poll(), which is a deprecated function. I tried changing it to use blocking reads instead, but those weren't returning from read() even for commands that did work with non-blocking reads before.
The text was updated successfully, but these errors were encountered:
I noticed also, that recv() never ends if ]]>]]> string it not the last string. That typically happens if the closing session reply message looks like this:
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/14.1X53/junos" message-id='2'>
<ok/>
</rpc-reply>
]]>]]>
<!-- session end at 2018-09-01 19:08:23 UTC -->
In which case the condition terminating the reading loop ...
} until($resp =~ s/]]>]]>$//);
... never matches and it loops infinitely as it will never read anything again. The fix which worked for me was to use the multiline match:
Our software sometimes sends a request-logout-user command whose name also matches the active session: "$client->send_and_recv_rpc('our-name');" But the send_and_recv_rpm call never returns in that case. In older NET::NETCONF versions it caused the script to exit with an error message about losing connection, which is the desired behavior. Looking at the code, I expect it would also get stuck if the session spontaneously died for other reasons, like idle timeout.
Looking in the NET::NETCONF code, I traced this problem to 2 causes. One already appears to be addressed in #31 "adding exception handling for reads and writes". The other though is that poll() never returns when the session dies in this case. Poll() is calling libssh2_poll(), which is a deprecated function. I tried changing it to use blocking reads instead, but those weren't returning from read() even for commands that did work with non-blocking reads before.
The text was updated successfully, but these errors were encountered: