From 0ef7ee597c71d1ad35062ba1ce7c422a65613f09 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Thu, 2 Jul 2026 13:43:19 +0300 Subject: [PATCH] =?UTF-8?q?tcp=5Fio:=20fix=20write=5Fcb=20busy-loop=20with?= =?UTF-8?q?=20deferred=20callback=20=E2=80=94=20turn=20off=20write=5Fmonit?= =?UTF-8?q?or=20after=20flush=20when=20waiter=5Fdefer=3D1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tcp_io.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/tcp_io.c b/lib/tcp_io.c index 0080386e..dc2bae70 100644 --- a/lib/tcp_io.c +++ b/lib/tcp_io.c @@ -387,6 +387,10 @@ static void write_cb(socket_t sock, void* arg) { 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) { + uasync_set_socket_write(tc->ua, tc->socket_id, 0); + tc->write_monitor = 0; + } } }