TRACE CDB_NEW_SESSION DEBUG locked - Could not acquire lock

Hi ,

I am getting this issue , it is not able to acquire lock.

After enabling confD trace … we found the below error

TRACE CDB_SUBSCRIBE_DONE  --> CONFD_OK
TRACE Connected (cdb) to ConfD
TRACE Connected (maapi) to ConfD
[18-7-2018 14:15:7] CONFD:Reading context Info
TRACE Connected (cdb) to ConfD
TRACE CDB_NEW_SESSION DEBUG locked - Could not acquire lock
 --> CONFD_ERR
DEBUG Failed to create new session to ConfD

We retry for multiple times, if it fails and some time it will get crashed…

Code snippet:

int read_context_info()
{
    printf("CONFD:Reading context Info \n");
    int rsock, n, st = CONFD_OK, i = 0;
    char name[32];

    reset_context_list();

    if ((rsock = socket(PF_INET, SOCK_STREAM, 0)) < 0 )
      return CONFD_ERR;
    if (cdb_connect(rsock, CDB_READ_SOCKET, (struct sockaddr*)&eb_addr,
                sizeof (struct sockaddr_in)) < 0)
      return CONFD_ERR;
    if (cdb_start_session(rsock, CDB_RUNNING) != CONFD_OK)
      return CONFD_ERR;
    if ((n = cdb_num_instances(rsock, "/ctxsipos:contexts/ctxipos:context"))
         < 0) {
        cdb_end_session(rsock);
        cdb_close(rsock);
        return n;
    }
    printf("CONFD:Number of contexts = %d\n", n);

    for( i = 0 ; i < n; i++)
      {
        cdb_get_str(rsock, name ,32 , "/contexts/context[%d]/context-name", i);
        strcpy(ctx_list[num_ctx].ctx_name, name);
        ctx_list[num_ctx].status = created;
        num_ctx++;
      }

    printf("CONFD:Number of entries in ctx_list = %d\n", num_ctx);
    //Remove the file is already present
    remove(CONTEXT_FILE);
    update_context_details();
    cdb_end_session(rsock);
    cdb_close(rsock);
    return st;
}

Can you help me out the reason for this issue

Regards,
Bibin

We added read_context_info() in a while().
So thats the reason it will retry till it gets the success API.