Trigger callback from another callback registered within same call-point


I’ve a particular YANG file-


  container odu {
    presence "Attributes related to ODU interface.";
    leaf rate {
      type string;
    container opu {
      leaf payload {
        type string {
          length 2;
        default "NA";

To this YANG file, I’ve an annotation file, that adds hook call-points to ‘odu’ and ‘payload’. Also, both are registered under same call-point.

  tailf:annotate /odu {
    tailf:callpoint DefaultHook {
      tailf:set-hook node;
  tailf:annotate "odu/opu/payload" {
    tailf:callpoint DefaultHook {
      tailf:set-hook subtree;

Further, ‘payload’ has a default value. Also when a user creates ‘odu’ container, providing only ‘rate’ value but not ‘opu/payload’ value, then hook has to set ‘payload’ based on ‘rate’ value.

As per this, within hook implementation, during create() call for ‘odu’, I check rate and set a value for ‘payload’. I expected that this will trigger set_elem() from same call-point for ‘payload’. However, I see that maapi_set_elem2() function used to set payload value hangs and does not return. After a while, worker socket gets closed due to timeout.


<ERR> 23-Feb-2020::22:04:28.653 endor confd[32334]: devel-c Worker socket query timed out daemon my_hook id 7
<ERR> 23-Feb-2020::22:04:28.657 endor confd[32334]: devel-c set_elem error {external_timeout, ""} for callpoint DefaultHook path /odu/opu/payload-type
<ERR> 23-Feb-2020::22:04:28.657 endor confd[32334]: devel-c create error {external_timeout, ""} for callpoint DefaultHook path /odu

I’ve a multi-threaded hook implementation. It has a main thread, a control thread for control socket and creates a new worker thread for every worker socket. Again each worker socket creates a new thread to handle every callback that is registered under ‘DefaultHook’. Finally each callback thread creates its own maapi socket connection. But, maapi_set_elem2() call still hangs and does not return.

Can you please let me know if I’m missing something? How should I model my hook implementation so that it can trigger one callback from within another callback: both registered under same call-point, and execute both of them concurrently?

Thanks in advance.

ConfD version: 6.5.9

First of all - it sounds like you may want to use transaction hooks, not set hooks - transaction hooks are invoked at the end of the transaction, i.e. when all operator changes have been applied. Set hooks are invoked immediately when something relevant happens with the node(s) where the hook is declared - this means that when you call maapi_set_elem2() from inside your set-hook callback, ConfD immediately tries to invoke the same callpoint’s set-hook callback.

Then: multiple threads cannot help you here, for given transaction and callpoint only one thread is used for hook callbacks by ConfD. As you can see, this inevitably leads to a deadlock. If you change your hooks to transaction hooks, there is some chance that ConfD waits for one callback to complete before it invokes the other - I am not sure about that, you have to try; but it is generally not advisable that a callpoint “depends on itself”.

Your other option is to have the two nodes, odu and payload, being served by different callpoints. I am not sure if this alone helps; it still might be necessary that the callpoints are registered by different daemons (though the daemons may be created from within the same OS process).