From 7da254fc455b9748f27acf0c7aeaaec4209fac99 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Feb 2026 23:36:18 +0000 Subject: [PATCH] Fix request_id mismatch causing 5s hang on every PUT commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The COMMIT_PUT message was built with request_id N, then request_id was incremented to N+1 immediately after sending. When the server replied with request_id N, the client compared it against N+1, silently discarded the reply, and waited for the 5-second timeout. The timeout retry (replay_request) then resent with N+1, which matched — so every PUT paid an unnecessary 5-second penalty. Move the request_id++ before building the CommitPutMessage, matching the pattern already used by toastyfs_async_delete. https://claude.ai/code/session_01EG3WZSH3ZeTdAbb5T42r2w --- src/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client.c b/src/client.c index 95cf160..83395c8 100644 --- a/src/client.c +++ b/src/client.c @@ -455,6 +455,7 @@ static int process_message(ToastyFS *tfs, begin_transfers(tfs); if (all_chunk_transfers_completed(tfs)) { + tfs->request_id++; CommitPutMessage msg = { .base = { .version = MESSAGE_VERSION, @@ -477,7 +478,6 @@ static int process_message(ToastyFS *tfs, msg.oper.chunks[i].size = tfs->chunk_sizes[i]; } send_message_to_server(tfs, leader_idx(tfs), &msg.base); - tfs->request_id++; tfs->step = STEP_COMMIT; client_log(tfs, "SEND COMMIT_PUT", "key=%s chunks=%d req=%lu", tfs->key, tfs->num_chunks, tfs->request_id);