netopeer2 icon indicating copy to clipboard operation
netopeer2 copied to clipboard

Netopeer2 does not handle concurrent gets

Open trentzhou opened this issue 1 year ago • 3 comments

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: image

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.

trentzhou avatar Dec 19 '24 09:12 trentzhou

I actually have this change in TODO but had not got to it yet. However, there is a requirement for NETCONF pipelining so I am not sure the change you made would not cause a deviation from the standard.

michalvasko avatar Dec 19 '24 09:12 michalvasko

Thanks @michalvasko for your quick response.

The RFC document https://datatracker.ietf.org/doc/html/rfc6241#section-4.5 did not say how different sessions should work.

I found this discussion on tail-f site: https://discuss.tail-f.com/t/pipelining-versus-netconf-session/3675. It seems confd can handle concurrent get requests.

trentzhou avatar Dec 19 '24 09:12 trentzhou

Okay, then like I said, it should be implemented at some point next year.

michalvasko avatar Dec 19 '24 09:12 michalvasko