Bug: Server receive_thread doesn't propagate file_receive / chunk receive errors #167

Closed
opened 2026-07-29 18:36:32 +02:00 by TapTap · 0 comments
Owner

Description

In src/shared/multiprocessing.c, the server receive_thread() does not propagate failures from file_receive() or receive_chunk_enqueue(). When file_receive() returns NULL, the thread logs an error but continues to read the next status, which desynchronizes the protocol. When receive_chunk_enqueue() returns NULL (chunk receive failed), it simply returns without setting receiver_done, which can cause the writer thread to hang forever waiting on an empty queue.

Location

  • src/shared/multiprocessing.c:84-96receive_chunk_enqueue() returns without signaling on error.
  • src/shared/multiprocessing.c:121-127file_receive() failure is logged but not propagated.

Suggested fix

  1. Introduce an error flag in PipelineContextReceiver.
  2. On any receive error, set the flag and signal condition_not_empty so the writer thread can exit.
  3. Return thrd_error from receive_thread() on failure.

Severity

Medium

Category

bug, quality


This issue was automatically generated by the issue-creator agent.

## Description In `src/shared/multiprocessing.c`, the server `receive_thread()` does not propagate failures from `file_receive()` or `receive_chunk_enqueue()`. When `file_receive()` returns `NULL`, the thread logs an error but continues to read the next status, which desynchronizes the protocol. When `receive_chunk_enqueue()` returns `NULL` (chunk receive failed), it simply returns without setting `receiver_done`, which can cause the writer thread to hang forever waiting on an empty queue. ## Location - `src/shared/multiprocessing.c:84-96` — `receive_chunk_enqueue()` returns without signaling on error. - `src/shared/multiprocessing.c:121-127` — `file_receive()` failure is logged but not propagated. ## Suggested fix 1. Introduce an error flag in `PipelineContextReceiver`. 2. On any receive error, set the flag and signal `condition_not_empty` so the writer thread can exit. 3. Return `thrd_error` from `receive_thread()` on failure. ## Severity Medium ## Category bug, quality --- _This issue was automatically generated by the issue-creator agent._
TapTap added the bugqualityneeds-triagethreading labels 2026-07-29 18:36:32 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#167