`rndc` sometimes crashes when it's interrupted by a signal
Summary
rndc
sometimes crashes when it's interrupted by a signal
BIND version used
- ~"Affects v9.17" : ca1a6640
- Affects v9.16 : ebec9c70
Steps to reproduce
- configure control channel:
rndc-confgen -a
- run
named
with an arbitrary configuration,-c /dev/null
- run
rndc
in a loop, signal to terminate in short time so it is likely to get interrupted in the middle of operation:
while true; do timeout 0.01 rndc flush; done
- play with 0.01 timeout to find a fit for your machine
What is the current bug behavior?
rndc
crashes:
~"Affects v9.17" :
rndc: connect failed: 127.0.0.1#953: shutting down
task.c:721: REQUIRE(((task) != ((void *)0) && ((const isc__magic_t *)(task))->magic == ((('T') << 24 | ('A') << 16 | ('S') << 8 | ('K'))))) failed, back trace
task.c:293: INSIST(__v > 0 && __v < (4294967295U)) failed, back trace
What is the expected correct behavior?
Well, it should not crash :-)
Relevant configuration files
None.
Relevant logs and/or screenshots
gdb back trace ~"Affects v9.17" :
```
(gdb) bt
#0 0x00007fac6c407d22 in raise () from /usr/lib/libc.so.6
#1 0x00007fac6c3f1862 in abort () from /usr/lib/libc.so.6
#2 0x00007fac6d367740 in isc_assertion_failed (file=0x7fac6d3c36ed "task.c", line=721,
type=isc_assertiontype_require,
cond=0x7fac6d3c3ca0 "((task) != ((void *)0) && ((const isc__magic_t *)(task))->magic == ((('T') << 24 | ('A') << 16 | ('S') << 8 | ('K'))))") at assertions.c:48
#3 0x00007fac6d3956ec in isc_task_shutdown (task=0x0) at task.c:721
#4 (closed) 0x00005557fb200e81 in rndc_recvdone (handle=0x7fac6881f000, result=ISC_R_NOTFOUND,
arg=0x5557fb208ba0 ) at rndc.c:394
#5 (closed) 0x00007fac6d04732c in recv_data (handle=0x7fac6881f000, eresult=ISC_R_SUCCESS, region=0x7fac69579f80,
arg=0x5557fb208ba0 ) at ccmsg.c:110
#6 (closed) 0x00007fac6d34f5db in isc__nm_async_readcb (worker=0x0, ev0=0x7fac69579ff0) at netmgr/netmgr.c:2807
#7 (closed) 0x00007fac6d34f3db in isc__nm_readcb (sock=0x7fac68800000, uvreq=0x7fac6881a000, eresult=ISC_R_SUCCESS)
at netmgr/netmgr.c:2780
#8 (closed) 0x00007fac6d35438c in isc__nm_tcp_read_cb (stream=0x7fac688005b0, nread=261, buf=0x7fac6957a100)
at netmgr/tcp.c:884
#9 (closed) 0x00007fac6cdb23a1 in ?? () from /usr/lib/libuv.so.1
#10 (closed) 0x00007fac6cdb2cf8 in ?? () from /usr/lib/libuv.so.1
#11 (closed) 0x00007fac6cdbb266 in ?? () from /usr/lib/libuv.so.1
#12 (closed) 0x00007fac6cda7897 in uv_run () from /usr/lib/libuv.so.1
#13 (closed) 0x00007fac6d34656b in nm_thread (worker0=0x7fac69cc3000) at netmgr/netmgr.c:689
#14 (closed) 0x00007fac6d39f8b0 in isc__trampoline_run (arg=0x7fac69c77c80) at trampoline.c:185
#15 (closed) 0x00007fac6c5a0259 in start_thread () from /usr/lib/libpthread.so.0
#16 (closed) 0x00007fac6c4c95e3 in clone () from /usr/lib/libc.so.6
```
gdb back trace Affects v9.16 :
```
(gdb) bt
#0 0x00007f4cf8861d22 in raise () from /usr/lib/libc.so.6
#1 0x00007f4cf884b862 in abort () from /usr/lib/libc.so.6
#2 0x0000563710a317dc in isc_assertion_failed (file=0x563710a99c8d "task.c", line=293,
type=isc_assertiontype_insist, cond=0x563710a9a058 "__v > 0 && __v < (4294967295U)") at assertions.c:47
#3 0x0000563710a69f32 in isc_task_attach (source=0x563711deca30, targetp=0x7f4cf5cc4470) at task.c:293
#4 (closed) 0x0000563710a7e542 in isc_socket_connect (sock=0x7f4cf0000b60, addr=0x563710ab71a0 ,
task=0x563711deca30, action=0x563710a16e33 , arg=0x0) at socket.c:4780
#5 (closed) 0x0000563710a176b1 in rndc_startconnect (addr=0x563710ab71a0 , task=0x563711deca30)
at ./rndc.c:573
#6 (closed) 0x0000563710a17770 in rndc_start (task=0x563711deca30, event=0x0) at ./rndc.c:583
#7 (closed) 0x0000563710a6c10d in task_run (task=0x563711deca30) at task.c:857
#8 (closed) 0x0000563710a6c386 in isc_task_run (task=0x563711deca30) at task.c:950
#9 (closed) 0x0000563710a48555 in isc__nm_async_task (worker=0x563711dee210, ev0=0x563711e4c7a0) at netmgr.c:859
#10 (closed) 0x0000563710a4880d in process_netievent (worker=0x563711dee210, ievent=0x563711e4c7a0) at netmgr.c:938
#11 (closed) 0x0000563710a48f79 in process_queue (worker=0x563711dee210, type=NETIEVENT_TASK) at netmgr.c:1007
#12 (closed) 0x0000563710a483a1 in process_all_queues (worker=0x563711dee210) at netmgr.c:778
#13 (closed) 0x0000563710a48425 in async_cb (handle=0x563711dee570) at netmgr.c:807
#14 (closed) 0x00007f4cf8a28fcd in ?? () from /usr/lib/libuv.so.1
#15 (closed) 0x00007f4cf8a3d266 in ?? () from /usr/lib/libuv.so.1
#16 (closed) 0x00007f4cf8a29897 in uv_run () from /usr/lib/libuv.so.1
#17 (closed) 0x0000563710a47f61 in nm_thread (worker0=0x563711dee210) at netmgr.c:713
#18 (closed) 0x0000563710a6ef3b in isc__trampoline_run (arg=0x563711defa20) at trampoline.c:196
#19 (closed) 0x00007f4cf89fa259 in start_thread () from /usr/lib/libpthread.so.0
#20 (closed) 0x00007f4cf89235e3 in clone () from /usr/lib/libc.so.6
```