From 5ca0bbf9e75dd6949281ec0d8ddbde772c9e1192 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Thu, 2 Jul 2026 13:50:43 +0300 Subject: [PATCH] tcp_io: place write_monitor=0 before queue_resume_callback to prevent busy-loop when waiter_defer=1 --- lib/tcp_io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tcp_io.c b/lib/tcp_io.c index dc2bae70..95ca7e60 100644 --- a/lib/tcp_io.c +++ b/lib/tcp_io.c @@ -386,11 +386,11 @@ static void write_cb(socket_t sock, void* arg) { if (flush_write_buf(tc)) return; if (!tc->write_buf) { DEBUG_TRACE(DEBUG_CATEGORY_SOCKET, "tcp_io: write_cb flushed fd=%d wmon=%d (resume WQ cb)", (int)tc->sock, tc->write_monitor); - queue_resume_callback(tc->write_queue); - if (tc->write_queue->waiter_defer && tc->write_monitor) { + if (tc->write_queue->waiter_defer) { uasync_set_socket_write(tc->ua, tc->socket_id, 0); tc->write_monitor = 0; } + queue_resume_callback(tc->write_queue); } }