Skip to content

Fix transfer reliability, chunk safety, and bounded concurrency - #1

Open
daltschu22 wants to merge 4 commits into
masterfrom
fix/transfer-reliability
Open

daltschu22 wants to merge 4 commits into
masterfrom
fix/transfer-reliability

Conversation

@daltschu22

@daltschu22 daltschu22 commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Dsync could return success while transfers were still running or had failed, omit files during chunking, and write/delete testfile.dsync even during cloud dry runs. This change waits for bounded parallel transfers, reports failures, preserves filenames and dry-run behavior, and checks cloud source lists on the host performing the copy.

The implementation remains a single script organized around Fpart, Rsync, Rclone, and FilesystemOps, with a direct path-check → chunk → transfer workflow. Backend commands stay with their tools; scheduling, safe argument handling, and cancellation are shared. Popen supplies the process handles needed for concurrency and cleanup.

  • Use argument lists and quoted SSH commands; send chunk lists over stdin instead of requiring shared working files. Preserve remote path spelling. Both SSH hops use batch authentication, no terminal, preserved stdin, a 15-second connection timeout, and 15-second keepalives with three missed replies allowed.
  • Honor --rclone-config, remove cloud write probes, and fix recursive cloud basic chunking. Rclone's missing-file-list behavior can silently skip source entries; a small Python preflight on each transfer host validates the list and passes it to rclone through an unlinked temporary file. Disable interactive config-password prompts.
  • Include hidden files and special names. Use NUL-delimited rsync lists and raw rclone lists; retain rsync symlinks and empty directories.
  • Replace incompatible fpart -Z usage, detect traversal diagnostics even when fpart exits zero, and avoid recursive re-copying of fpart chunks.
  • Stream basic chunking, cap open chunk files at 32, avoid eagerly collecting filenames from wide cloud source directories, skip empty jobs, and enforce -n during reuse.
  • Handle SIGINT/SIGTERM and process-registration races; finish cleanup despite additional signals and stop surviving local process-group members after the grace period.
  • Lock working directories, stage partitions, validate reuse, and replace only verified unchanged chunks from an ownership manifest. Preserve unrelated/modified files and reject overlapping local source/destination/work paths.
  • Add documentation and a Python 3.10/3.14 CI matrix.

Validation:

  • 44 regression/integration tests passed locally with no skips, using Python 3.14.4, rsync 3.4.1, fpart 1.7.0, and rclone 1.60.1-DEV. Coverage includes actual local copies, special filenames, dry runs, permissions, reuse, ownership, concurrency, locking, interruption, missing cloud sources on workers, a dropped loopback HTTP connection, and 128 chunks under a 64-descriptor limit. Python compilation and git diff --check passed.
  • Manual validation against an isolated real loopback OpenSSH server passed: rsync on source workers, rsync to destination hosts, nested worker-to-destination SSH, and rclone on workers. This exercises the real SSH transport; it does not establish cross-machine NFS behavior.
  • Real rclone uploads to a temporary loopback WebDAV server passed. Stopping the server during a throttled 16 MiB upload returned failure; restarting it and rerunning with --reuse produced the complete verified file.
  • A local 100,000-file, eight-chunk cloud-list generation comparison reduced peak Python allocation from 6.735 MiB to 1.011 MiB (tracemalloc); elapsed time was 2.554 s versus 2.412 s. This is a chunk-generation measurement, not a cloud/NFS throughput benchmark.

Compatibility and limits: legacy chunks need regeneration. Modified/unrecognized working files require review or a new working directory. Cloud workers now require python3, writable temporary space for file lists, and noninteractive rclone credentials. Source checks add metadata lookups and cannot prevent source changes after validation; use a stable snapshot. New files require regenerated lists. Newline/carriage-return filenames fail explicitly for older rclone compatibility. Host files support DNS/IPv4/SSH aliases; SSH filesystem destinations must be absolute. Actual multi-machine NFS mounts and external cloud providers remain untested. SSH keepalives do not impose a total job deadline or resolve blocked NFS I/O; remote cleanup depends on SSH/backend disconnect behavior. Failures can leave completed chunks, and incomplete-upload cleanup/resumption is backend-specific. The README explains resource scaling and conditional rclone destination-listing tuning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant