Lock and unlock from netconf client


I am sending lock rpc message from the netconf client, and receive rpc-reply with OK.
lookking at the callbacks that were called by the confd, I see that both lock and then unlock callbacks were called:

TRACE New user session: 20 for user:admin ctx:netconf --> CONFD_OK
TRACE CALL db lock(running) --> CONFD_OK
TRACE CALL db unlock(running) --> CONFD_OK
TRACE Close user sess 20

can you explain why the unlock callback was called as well?
Is there a timer that I should configure in confd?
please see below the confd_netconf.log.


28-Nov-2017::15:32:38.514 isim_Host1 confd[18131]: netconf id=20 new ssh
session for user “admin” from
28-Nov-2017::15:32:38.673 isim_Host1 confd[18131]: netconf id=20 got rpc:
{urn:ietf:params:xml:ns:netconf:base:1.0}lock attrs: message-id=“urn:uuid:40b7f
28-Nov-2017::15:32:38.674 isim_Host1 confd[18131]: netconf id=20 lock tar
get=running attrs: message-id=“urn:uuid:40b7f329-cdcf-4cca-bdcb-a147308dcf3b”
28-Nov-2017::15:32:38.676 isim_Host1 confd[18131]: netconf id=20 sending
rpc-reply, attrs: message-id=“urn:uuid:40b7f329-cdcf-4cca-bdcb-a147308dcf3b”
28-Nov-2017::15:32:38.785 isim_Host1 confd[18131]: netconf id=20 close-se
ssion attrs: message-id=“urn:uuid:3ce2a2a0-a099-4a09-adee-8da4cca70174”
28-Nov-2017::15:32:38.787 isim_Host1 confd[18131]: netconf id=20 sending
rpc-reply, attrs: message-id=“urn:uuid:3ce2a2a0-a099-4a09-adee-8da4cca70174”

The user session ends as indicated by the “TRACE Close user sess 20
–> CONFD_OK” message.

From RFC 6241:
The duration of the lock is defined as beginning when the lock is acquired and lasting until either the lock is released or the NETCONF session closes.

Hi Jonas,

One more related question.
While the DB is locked, if another client call lock() to Confd, does Confd retruns Error or calls the lock callback? I would like to know if the following scenario is valid: DB locked by NetConf client and lock callback is operating by confd due to other client request (or Confd takes care and blocks that)?
In a similar way, if a client calls commit while the DB is locked by other client, does Confd block it or Prepare/Commit callback will be issued and I should implement such block?