Control socket closed with error -2 and then ConfD client exit with "INTERNAL ERROR"

I believe you are looking for something like the confd_set_daemon_flags() function CONFD_DAEMON_FLAG_REG_REPLACE_DISCONNECT flag. See the confd_lib_dp(3) man page for details and this old topic: