bind9/bin
Michał Kępień fc678b19d9 Fix rare control channel socket reference leak
Commit 9ee60e7a17 enabled netmgr shutdown
to cause read callbacks for active control channel sockets to be invoked
with the ISC_R_SHUTTINGDOWN result code.  However, control channel code
only recognizes ISC_R_CANCELED as an indicator of an in-progress netmgr
shutdown (which was correct before the above commit).  This discrepancy
enables the following scenario to happen in rare cases:

 1. A control channel request is received and responded to.  libuv
    manages to write the response to the TCP socket, but the completion
    callback (control_senddone()) is yet to be invoked.

 2. Server shutdown is initiated.  All TCP sockets are shut down, which
    i.a. causes control_recvmessage() to be invoked with the
    ISC_R_SHUTTINGDOWN result code.  As the result code is not
    ISC_R_CANCELED, control_recvmessage() does not set
    listener->controls->shuttingdown to 'true'.

 3. control_senddone() is called with the ISC_R_SUCCESS result code.  As
    neither listener->controls->shuttingdown is 'true' nor is the result
    code ISC_R_CANCELED, reading is resumed on the control channel
    socket.  However, this read can never be completed because the read
    callback on that socket was cleared when the TCP socket was shut
    down.  This causes a reference on the socket's handle to be held
    indefinitely, leading to a hang upon shutdown.

Ensure listener->controls->shuttingdown is also set to 'true' when
control_recvmessage() is invoked with the ISC_R_SHUTTINGDOWN result
code.  This ensures the send completion callback does not resume reading
after the control channel socket is shut down.
2021-12-28 08:36:01 +01:00
..
check remove all references to isc_socket and related types 2021-10-15 01:01:25 -07:00
confgen Use #pragma once as header guards 2021-10-13 00:49:15 -07:00
delv remove all references to isc_socket and related types 2021-10-15 01:01:25 -07:00
dig Disable IDN2_USE_STD3_ASCII_RULES to idn2 conversion functions 2021-12-01 16:10:04 +01:00
dnssec Drop cppcheck workarounds 2021-12-14 15:03:56 +01:00
named Fix rare control channel socket reference leak 2021-12-28 08:36:01 +01:00
nsupdate remove all references to isc_socket and related types 2021-10-15 01:01:25 -07:00
plugins Make isc_result a static enum 2021-10-06 11:22:20 +02:00
rndc Update the description of fetches-per-zone counters 2021-11-30 11:10:04 +00:00
tests remove broken-nsec and reject-000-label options 2021-12-23 15:13:46 +11:00
tools Make mdig use the OS-supplied ephemeral port range 2021-11-17 14:13:17 -08:00
Makefile.am Remove native PKCS#11 support 2021-09-09 15:35:39 +02:00