mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
limit the time we wait for netmgr to be destroyed
if more than 10 seconds pass while we wait for netmgr events to finish running on shutdown, something is almost certainly wrong and we should assert and crash.
This commit is contained in:
@@ -393,6 +393,7 @@ isc_nm_closedown(isc_nm_t *mgr) {
|
||||
void
|
||||
isc_nm_destroy(isc_nm_t **mgr0) {
|
||||
isc_nm_t *mgr = NULL;
|
||||
int counter = 0;
|
||||
|
||||
REQUIRE(mgr0 != NULL);
|
||||
REQUIRE(VALID_NM(*mgr0));
|
||||
@@ -407,7 +408,7 @@ isc_nm_destroy(isc_nm_t **mgr0) {
|
||||
/*
|
||||
* Wait for the manager to be dereferenced elsewhere.
|
||||
*/
|
||||
while (isc_refcount_current(&mgr->references) > 1) {
|
||||
while (isc_refcount_current(&mgr->references) > 1 && counter++ < 1000) {
|
||||
/*
|
||||
* Sometimes libuv gets stuck, pausing and unpausing
|
||||
* netmgr goes over all events in async queue for all
|
||||
@@ -423,6 +424,8 @@ isc_nm_destroy(isc_nm_t **mgr0) {
|
||||
#endif /* ifdef WIN32 */
|
||||
}
|
||||
|
||||
INSIST(counter <= 1000);
|
||||
|
||||
/*
|
||||
* Detach final reference.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user