Error while calling cdb_set_namespace , how to handle?

Hi All!

I see that in the confd user guide example we are performing…

cdb_start_session

cdb_set_namespace ==> if error return

shouldn’t we be closing the cdb_session before return ?. Now what happens if their is a failure and we again start session, do we get error like below ?.. We see this issue want to know why its happening

CDB_NEW_SESSION DEBUG Bad protocol usage or unexpected retval - must call END_SESSION before NEW_SESSION

rgds
Balaji

You should call cdb_close() or cdb_end_session() before calling cdb_start_session() again. For more information, see confd_lib_lib man-page.

1 Like

Thanks for the reply. I see the lock is removed if we do a cdb_end_session, but is it mandatory to call cdb_close ?. I see from user guide that it releases the lock if we call cdb_end_session.

cdb_close() or cdb_end_session(), no need to call both.

Thanks for the prompt response…