mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
fix: dev: Move the call_rcu_thread explicit create and shutdown to isc_loop
When isc__thread_initialize() is called from a library constructor, it could be called before we fork the main process. This happens with named, and then we have the call_rcu_thread attached to the pre-fork process and not the post-fork process, which means that the initial process will never shutdown, because there's noone to tell it so. Move the isc__thread_initialize() and isc__thread_shutdown() to the isc_loop unit where we call it before creating the extra thread and after joining all the extra threads respectively. Closes #5281 Merge branch '5281-move-call_rcu-thread-ctor-dtor-to-main-thread' into 'main' See merge request isc-projects/bind9!10394
This commit is contained in:
@@ -49,7 +49,6 @@ isc__lib_initialize(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rcu_register_thread();
|
rcu_register_thread();
|
||||||
isc__thread_initialize();
|
|
||||||
isc__os_initialize();
|
isc__os_initialize();
|
||||||
isc__mutex_initialize();
|
isc__mutex_initialize();
|
||||||
isc__mem_initialize();
|
isc__mem_initialize();
|
||||||
@@ -76,7 +75,6 @@ isc__lib_shutdown(void) {
|
|||||||
isc__mem_shutdown();
|
isc__mem_shutdown();
|
||||||
isc__mutex_shutdown();
|
isc__mutex_shutdown();
|
||||||
isc__os_shutdown();
|
isc__os_shutdown();
|
||||||
isc__thread_shutdown();
|
|
||||||
/* should be after isc__mem_shutdown() which calls rcu_barrier() */
|
/* should be after isc__mem_shutdown() which calls rcu_barrier() */
|
||||||
rcu_unregister_thread();
|
rcu_unregister_thread();
|
||||||
}
|
}
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
#include "async_p.h"
|
#include "async_p.h"
|
||||||
#include "job_p.h"
|
#include "job_p.h"
|
||||||
#include "loop_p.h"
|
#include "loop_p.h"
|
||||||
|
#include "thread_p.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private
|
* Private
|
||||||
@@ -497,6 +498,8 @@ isc_loopmgr_run(isc_loopmgr_t *loopmgr) {
|
|||||||
*/
|
*/
|
||||||
ignore_signal(SIGPIPE, SIG_IGN);
|
ignore_signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
|
isc__thread_initialize();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The thread 0 is this one.
|
* The thread 0 is this one.
|
||||||
*/
|
*/
|
||||||
@@ -619,6 +622,8 @@ isc_loopmgr_destroy(isc_loopmgr_t **loopmgrp) {
|
|||||||
isc_barrier_destroy(&loopmgr->pausing);
|
isc_barrier_destroy(&loopmgr->pausing);
|
||||||
|
|
||||||
isc_mem_putanddetach(&loopmgr->mctx, loopmgr, sizeof(*loopmgr));
|
isc_mem_putanddetach(&loopmgr->mctx, loopmgr, sizeof(*loopmgr));
|
||||||
|
|
||||||
|
isc__thread_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
|
Reference in New Issue
Block a user