From: Alain Spineux Date: Wed, 12 Jan 2022 14:24:20 +0000 (+0100) Subject: strengthen JCR reference inc and dec in the FD X-Git-Tag: Beta-15.0.0~682 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8578a707854315822519df4f3d62bddec0808c93;p=thirdparty%2Fbacula.git strengthen JCR reference inc and dec in the FD - I got a crash at dir->close() while the FD was traced with GDB and waiting for too long on the GDB prompt - this problem should never happens on production system when not using GDB - Anyway using GDB should not crash the FD --- diff --git a/bacula/src/filed/heartbeat.c b/bacula/src/filed/heartbeat.c index 9fb096598..2ad2f6036 100644 --- a/bacula/src/filed/heartbeat.c +++ b/bacula/src/filed/heartbeat.c @@ -213,6 +213,7 @@ static void *dir_heartbeat_thread(void *arg) } dir->close(); jcr->hb_status = -1; // Mark as stopped + free_jcr(jcr); return NULL; } @@ -222,6 +223,7 @@ static void *dir_heartbeat_thread(void *arg) void start_dir_heartbeat(JCR *jcr) { if (!no_signals && (me->heartbeat_interval > 0)) { + jcr->inc_use_count(); jcr->dir_bsock->set_locking(); pthread_create(&jcr->heartbeat_id, NULL, dir_heartbeat_thread, (void *)jcr); }