2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Gracefully handle uv_read_start() failures

Under specific rare timing circumstances the uv_read_start() could
fail with UV_EINVAL when the connection is reset between the connect (or
accept) and the uv_read_start() call on the nmworker loop.  Handle such
situation gracefully by propagating the errors from uv_read_start() into
upper layers, so the socket can be internally closed().
This commit is contained in:
Ondřej Surý
2022-06-14 09:17:08 +02:00
parent 520cf01d56
commit b432d5d3bc
6 changed files with 73 additions and 30 deletions

View File

@@ -1118,7 +1118,7 @@ void
isc__nm_async_udpread(isc__networker_t *worker, isc__netievent_t *ev0) {
isc__netievent_udpread_t *ievent = (isc__netievent_udpread_t *)ev0;
isc_nmsocket_t *sock = ievent->sock;
isc_result_t result = ISC_R_SUCCESS;
isc_result_t result;
UNUSED(worker);
@@ -1129,6 +1129,8 @@ isc__nm_async_udpread(isc__networker_t *worker, isc__netievent_t *ev0) {
result = ISC_R_SHUTTINGDOWN;
} else if (isc__nmsocket_closing(sock)) {
result = ISC_R_CANCELED;
} else {
result = isc__nm_start_reading(sock);
}
if (result != ISC_R_SUCCESS) {
@@ -1137,7 +1139,6 @@ isc__nm_async_udpread(isc__networker_t *worker, isc__netievent_t *ev0) {
return;
}
isc__nm_start_reading(sock);
isc__nmsocket_timer_start(sock);
}