URL: https://github.com/freeipa/bind-dyndb-ldap/pull/6 Author: tomaskrizek Title: #6: handle termination of syncrepl watcher thread Action: opened
PR body: """ In some cases, the thread could have been already terminated and sending a signal to the thread using pthread_kill() would result in an error. Now if the thread has already been terminated for some reason, only an error message is logged. https://fedorahosted.org/bind-dyndb-ldap/ticket/149 """ To pull the PR as Git branch: git remote add ghbind-dyndb-ldap https://github.com/freeipa/bind-dyndb-ldap git fetch ghbind-dyndb-ldap pull/6/head:pr6 git checkout pr6
From cad92e658b09c97d2693fd9d595bc8db2d7c0534 Mon Sep 17 00:00:00 2001 From: Tomas Krizek <tkri...@redhat.com> Date: Mon, 19 Dec 2016 12:39:07 +0100 Subject: [PATCH] handle termination of syncrepl watcher thread In some cases, the thread could have been already terminated and sending a signal to the thread using pthread_kill() would result in an error. Now if the thread has already been terminated for some reason, only an error message is logged. https://fedorahosted.org/bind-dyndb-ldap/ticket/149 --- src/ldap_helper.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ldap_helper.c b/src/ldap_helper.c index a11751d..bb94b3c 100644 --- a/src/ldap_helper.c +++ b/src/ldap_helper.c @@ -668,6 +668,7 @@ new_ldap_instance(isc_mem_t *mctx, const char *db_name, const char *parameters, result = isc_thread_create(ldap_syncrepl_watcher, ldap_inst, &ldap_inst->watcher); if (result != ISC_R_SUCCESS) { + ldap_inst->watcher = 0; log_error("Failed to create syncrepl watcher thread"); goto cleanup; } @@ -705,7 +706,10 @@ destroy_ldap_instance(ldap_instance_t **ldap_instp) * We use SIGUSR1 to not to interfere with any signal * used by BIND itself. */ - REQUIRE(pthread_kill(ldap_inst->watcher, SIGUSR1) == 0); + if (pthread_kill(ldap_inst->watcher, SIGUSR1) != 0) { + log_error("unable to send signal to syncrepl watcher thread " + "(already terminated?)"); + } RUNTIME_CHECK(isc_thread_join(ldap_inst->watcher, NULL) == ISC_R_SUCCESS); ldap_inst->watcher = 0;
-- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code