isc_nm_closedown seems to not close all connections
When the isccc_ccmsg_init()
is changed to attach to isc_nmhandle_t
and isccc_ccmsg_invalidate()
is changed to detach from isc_nmhandle_t
, the code either:
- hangs
- produces following backtrace on macOS:
ccmsg.c:48: INSIST((__builtin_expect(!!((ccmsg) != ((void*)0)), 1) && __builtin_expect(!!(((const isc__magic_t *)(ccmsg))->magic == ((('C') << 24 | ('C') << 16 | ('m') << 8 | ('s')))), 1))) failed, back trace
0 libisc.1704.dylib 0x0000000109c960fa default_callback + 74
1 libisc.1704.dylib 0x0000000109c9608a isc_assertion_failed + 10
2 libisccc.1702.dylib 0x0000000109f21e4e recv_data + 430
3 libisc.1704.dylib 0x0000000109c81a04 isc__nm_tcp_shutdown + 68
4 libuv.1.dylib 0x0000000109fe9f9a uv_walk + 151
5 libisc.1704.dylib 0x0000000109c7f13d process_queue + 413
6 libuv.1.dylib 0x0000000109feab68 uv__async_io + 279
7 libuv.1.dylib 0x0000000109ffa7f2 uv__io_poll + 1882
8 libuv.1.dylib 0x0000000109feaf9e uv_run + 359
9 libisc.1704.dylib 0x0000000109c7c1c5 nm_thread + 53
10 libsystem_pthread.dylib 0x00007fff6aa01109 _pthread_start + 148
11 libsystem_pthread.dylib 0x00007fff6a9fcb8b thread_start + 15
which strongly suggests that isc_nm_closedown()
actually doesn't close all the active connections, and there's interaction between the last call to isc_nmhandle_detach()
in isccc_ccmsg_invalidate()
and the callback. All the callbacks must be called before isc_nm_closedown()
returns and it doesn't seem to be the case here.