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.
(cherry picked from commit
2f2d60a9898faeeb8e9c8d7b80061d7e7845687c)
void
isc_nm_destroy(isc_nm_t **mgr0) {
isc_nm_t *mgr = NULL;
+ int counter = 0;
REQUIRE(mgr0 != NULL);
REQUIRE(VALID_NM(*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
#endif /* ifdef WIN32 */
}
+ INSIST(counter <= 1000);
+
/*
* Detach final reference.
*/