Confd_fd_ready for ctrl socket returns CONFD_ERR with error number 18

Hi,

For Netconf notification support, we created the ctrl socket and started polling.
Later we build the worker socket and use the confd_register_notification_stream API to register Netconf stream.

However, we could occasionally see the following error being reported :

[receive_fd_event] :	
**INTERNAL ERROR: Unknown callback op 12**
[receive_fd_event] : confd_fd_ready returned ret[-1]

[receive_fd_event] **Error on control socket request: (18)**

===================Code Snippet ========================

   if( events & EPOLLIN )
    {
	...
        ret = confd_fd_ready(_daemon_ctx, _socket_fd);
        LOG_INFO("confd_fd_ready returned ret[%d] \n",ret);
        if( (ret == CONFD_ERR) && (confd_errno != CONFD_ERR_EXTERNAL) )
        {
            LOG_INFO("Error on control socket request: (%d)\n", confd_errno );
            return;
        }
	...
    }		

Just so you’re aware, from the BT, it looks like its getting stuck at the confd_register_done callback.

#0 0x00007f596173075d in read () from /lib64/libpthread.so.0
#1 0x00007f596480e4a7 in read_fill (fd=49, buf=0x7f58e1e45790 “\v”, len=4) at confd_internal.c:858
#2 0x00007f5964812d3a in term_read (socket=socket@entry=49, ret=ret@entry=0x7f58e1e4583c, cdbop=cdbop@entry=4294967295) at confd_internal.c:1126
#3 0x00007f5964813fc1 in confd_call (socket=49, term=term@entry=0x7f58a01d2f80, status=status@entry=0x7f58e1e4583c) at confd_internal.c:1249
#4 0x00007f59647eb1a8 in confd_register_done (dx=0x36bcbd0) at confd_lib.c:3361
#5 0x00007f596457ce71 in notif_mgmt::register_notification_stream_done (this=this@entry=0x36bd150) at src/notif_mgmt.cpp:135

I’d be grateful if you could point us in the right direction.

Reagrds,
Haripriya

The most common reason for errors like this is that there are two or more threads that share one ConfD socket. In your case, it looks like the two threads both use the same control socket, one is registering the notification callbacks, the other is already waiting for callback invocations in confd_fd_ready.