netopeer2
netopeer2 copied to clipboard
Netopeer2 does not handle concurrent gets
This is a follow question of https://github.com/sysrepo/sysrepo/issues/3481.
For example, I have two netconf sessions.
Session A calls get /status/firewall/stats. This is a slow operation which may take a few seconds. The results is collected by a background task. Session B calls get /status/uptime. This is a very quick operation which could be handled immediately.
Originally the two xpaths are handled by the same subscription. I changed the code to two subscriptions, in my test, session B still has to wait until session A finishes the get.
The behavior is caused by the design of netopeer2:
The netconf request gets to netopeer, then function np2srv_rpc_cb is called. It calls sr_rpc_send_tree to invoke the rpc. This <get> request is then handled by the subscription thread. This subscription is locked. This prevents any new netconf requests.
Can np2srv_rpc_cb call np2srv_rpc_get_cb directly? I did a quick hack, both sessions can work concurrently with this change.