[BUG][med] Single files >64MiB cannot be transferred at all (receiver cap vs client streaming mismatch); client dies with SIGPIPE on abort #257

Closed
opened 2026-09-05 12:08:20 +02:00 by TapTap · 1 comment
Owner

Found by perf + bug review of dev (9f8b588).

Where: src/shared/protocol.h:15 MAX_RECEIVE_FILE_SIZE=64MiB enforced at src/shared/file_receive.c:387,520,574 + chunk.c:19,239,327; client streaming intent at src/client/client_send.c:29 STREAM_THRESHOLD, :705,:827 (sendfile streaming, data->data==NULL above threshold).

Problem: Client deliberately streams files >64MiB via sendfile framing, but every receiver path rejects >64MiB -> such transfers always fail. In plain/sendfile mode the server closes mid-stream and the client dies with SIGPIPE (exit 141) with no clean diagnostic.

Fix options: (a) make receiver stream to disk bounded by max_alloc instead of a fixed 64MiB whole-file allocation, or (b) raise the cap coherently behind the memory budget, AND make the client ignore SIGPIPE and error cleanly. Minimum: no silent SIGPIPE death; consistent documented ceiling.

Verify with a >64MiB file (unit or integration).

Found by perf + bug review of `dev` (9f8b588). **Where:** src/shared/protocol.h:15 MAX_RECEIVE_FILE_SIZE=64MiB enforced at src/shared/file_receive.c:387,520,574 + chunk.c:19,239,327; client streaming intent at src/client/client_send.c:29 STREAM_THRESHOLD, :705,:827 (sendfile streaming, data->data==NULL above threshold). **Problem:** Client deliberately streams files >64MiB via sendfile framing, but every receiver path rejects >64MiB -> such transfers always fail. In plain/sendfile mode the server closes mid-stream and the client dies with SIGPIPE (exit 141) with no clean diagnostic. **Fix options:** (a) make receiver stream to disk bounded by max_alloc instead of a fixed 64MiB whole-file allocation, or (b) raise the cap coherently behind the memory budget, AND make the client ignore SIGPIPE and error cleanly. Minimum: no silent SIGPIPE death; consistent documented ceiling. Verify with a >64MiB file (unit or integration).
Author
Owner

Resolved on dev (HEAD f7c6c91).

Fixed on dev via fix/receiver-correctness (14c064a): client ignores SIGPIPE; MAX_RECEIVE_WHOLE_FILE_SIZE=256MiB for whole-file paths (chunk cap stays 64MiB). Verified 100MiB transfer end-to-end; integration TestLargeFile added.

CI run #461: all jobs green (lint, build-and-test, sanitizers address+undefined, fuzz-build, coverage, valgrind). Unit 25/25, integration 83 passed / 10 skipped / 1 xpassed. Closing.

**Resolved on `dev`** (HEAD f7c6c91). Fixed on dev via fix/receiver-correctness (14c064a): client ignores SIGPIPE; MAX_RECEIVE_WHOLE_FILE_SIZE=256MiB for whole-file paths (chunk cap stays 64MiB). Verified 100MiB transfer end-to-end; integration TestLargeFile added. CI run #461: all jobs green (lint, build-and-test, sanitizers address+undefined, fuzz-build, coverage, valgrind). Unit 25/25, integration 83 passed / 10 skipped / 1 xpassed. Closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#257