Skip to content

Use exec for server mode fallback - #2198

Merged
oferchen merged 2 commits into
masterfrom
fix-server-and-rsync-path-implementations
Nov 21, 2025
Merged

oferchen merged 2 commits into
masterfrom
fix-server-and-rsync-path-implementations

Conversation

@oferchen

@oferchen oferchen commented Nov 21, 2025 •

Copy link
Copy Markdown
Owner

Summary

  • run --server fallback on Unix by exec'ing the resolved upstream binary to mirror upstream behaviour
  • keep test and Windows paths using piped forwarding through a helper for clarity

Testing

  • not run

[Codex Task](

@oferchen
oferchen merged commit 867b5a8 into master Nov 21, 2025
@oferchen
oferchen deleted the fix-server-and-rsync-path-implementations branch November 21, 2025 08:52

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/cli/src/frontend/server.rs Outdated
Comment on lines +152 to +154
if let Err(error) = command.exec() {
let text = format!(
"failed to launch fallback {upstream_program} binary '{}': {error}",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 Badge Fix exec error handling to compile on Unix

On Unix builds this new fallback path will not compile: CommandExt::exec returns an io::Error on failure, not a Result, so the pattern if let Err(error) = command.exec() produces E0308 (expected Error, found Result). Because this block is compiled for all non-test Unix targets, the crate now fails to build at all; handle the returned io::Error directly instead of matching on Err.

Useful? React with 👍 / 👎.

oferchen added a commit that referenced this pull request May 16, 2026
Adds INC_RECURSE diagnostic counter I3 (#2198): a process-global
AtomicU64 that tracks every writer.flush() invocation on the generator
transfer hot path so operators can quantify flush-per-file and
flush-per-batch overhead under inc_recursive sends.

The counter is bumped from a single flush_with_count() helper, replacing
the five hot-path writer.flush() sites in run_transfer_loop():

- per-iteration flush before reading the next NDX request
- NDX_DONE echo on the INC_RECURSE flist-free path
- NDX_DONE echo on phase transitions
- per-file flush on the dry-run write path
- final NDX_DONE goodbye flush at end of loop

End-of-loop, end-of-transfer flushes outside the hot path (send_stats,
handle_goodbye, the pre-recv_filter_list flush in run()) are left
untouched - they fire at most once per transfer and would dilute the
per-file ratio.

Totals are sampled in GeneratorContext::run via flush_rate_totals() in
the same finalize block used by the I1 first-byte probe and emitted via:

- debug_log!(Send, 1, ...) for human output
- tracing::debug!(target = "rsync::generator::flush_rate", ...) when the
  optional tracing feature is enabled

Public API: a new flush_rate_totals() free function in the generator
module. No CLI flag, no wire-format change, no change to the existing
hot-path function signatures.

Two unit tests cover the counter behaviour:

- flush_with_count_increments_global_counter asserts the counter grows
  by at least N after N flush_with_count() calls (>= guards against
  concurrent test runs incrementing the shared counter)
- flush_rate_totals_is_observable_without_flushing asserts the counter
  does not move when only the snapshot reader is called, confirming
  constructing a generator does not bump the counter on its own

upstream: sender.c send_files() per-iteration io_flush before recv_ndx

Closes #2198
oferchen added a commit that referenced this pull request May 16, 2026
Adds INC_RECURSE diagnostic counter I3 (#2198): a process-global
AtomicU64 that tracks every writer.flush() invocation on the generator
transfer hot path so operators can quantify flush-per-file and
flush-per-batch overhead under inc_recursive sends.

The counter is bumped from a single flush_with_count() helper, replacing
the five hot-path writer.flush() sites in run_transfer_loop():

- per-iteration flush before reading the next NDX request
- NDX_DONE echo on the INC_RECURSE flist-free path
- NDX_DONE echo on phase transitions
- per-file flush on the dry-run write path
- final NDX_DONE goodbye flush at end of loop

End-of-loop, end-of-transfer flushes outside the hot path (send_stats,
handle_goodbye, the pre-recv_filter_list flush in run()) are left
untouched - they fire at most once per transfer and would dilute the
per-file ratio.

Totals are sampled in GeneratorContext::run via flush_rate_totals() in
the same finalize block used by the I1 first-byte probe and emitted via:

- debug_log!(Send, 1, ...) for human output
- tracing::debug!(target = "rsync::generator::flush_rate", ...) when the
  optional tracing feature is enabled

Public API: a new flush_rate_totals() free function in the generator
module. No CLI flag, no wire-format change, no change to the existing
hot-path function signatures.

Two unit tests cover the counter behaviour:

- flush_with_count_increments_global_counter asserts the counter grows
  by at least N after N flush_with_count() calls (>= guards against
  concurrent test runs incrementing the shared counter)
- flush_rate_totals_is_observable_without_flushing asserts the counter
  does not move when only the snapshot reader is called, confirming
  constructing a generator does not bump the counter on its own

upstream: sender.c send_files() per-iteration io_flush before recv_ndx

Closes #2198
oferchen added a commit that referenced this pull request May 16, 2026
* feat(transfer): instrument writer.flush rate (INC_RECURSE I3)

Adds INC_RECURSE diagnostic counter I3 (#2198): a process-global
AtomicU64 that tracks every writer.flush() invocation on the generator
transfer hot path so operators can quantify flush-per-file and
flush-per-batch overhead under inc_recursive sends.

The counter is bumped from a single flush_with_count() helper, replacing
the five hot-path writer.flush() sites in run_transfer_loop():

- per-iteration flush before reading the next NDX request
- NDX_DONE echo on the INC_RECURSE flist-free path
- NDX_DONE echo on phase transitions
- per-file flush on the dry-run write path
- final NDX_DONE goodbye flush at end of loop

End-of-loop, end-of-transfer flushes outside the hot path (send_stats,
handle_goodbye, the pre-recv_filter_list flush in run()) are left
untouched - they fire at most once per transfer and would dilute the
per-file ratio.

Totals are sampled in GeneratorContext::run via flush_rate_totals() in
the same finalize block used by the I1 first-byte probe and emitted via:

- debug_log!(Send, 1, ...) for human output
- tracing::debug!(target = "rsync::generator::flush_rate", ...) when the
  optional tracing feature is enabled

Public API: a new flush_rate_totals() free function in the generator
module. No CLI flag, no wire-format change, no change to the existing
hot-path function signatures.

Two unit tests cover the counter behaviour:

- flush_with_count_increments_global_counter asserts the counter grows
  by at least N after N flush_with_count() calls (>= guards against
  concurrent test runs incrementing the shared counter)
- flush_rate_totals_is_observable_without_flushing asserts the counter
  does not move when only the snapshot reader is called, confirming
  constructing a generator does not bump the counter on its own

upstream: sender.c send_files() per-iteration io_flush before recv_ndx

Closes #2198

* ci: trigger workflow

* ci: trigger workflow
oferchen added a commit that referenced this pull request May 18, 2026
* feat(transfer): instrument writer.flush rate (INC_RECURSE I3)

Adds INC_RECURSE diagnostic counter I3 (#2198): a process-global
AtomicU64 that tracks every writer.flush() invocation on the generator
transfer hot path so operators can quantify flush-per-file and
flush-per-batch overhead under inc_recursive sends.

The counter is bumped from a single flush_with_count() helper, replacing
the five hot-path writer.flush() sites in run_transfer_loop():

- per-iteration flush before reading the next NDX request
- NDX_DONE echo on the INC_RECURSE flist-free path
- NDX_DONE echo on phase transitions
- per-file flush on the dry-run write path
- final NDX_DONE goodbye flush at end of loop

End-of-loop, end-of-transfer flushes outside the hot path (send_stats,
handle_goodbye, the pre-recv_filter_list flush in run()) are left
untouched - they fire at most once per transfer and would dilute the
per-file ratio.

Totals are sampled in GeneratorContext::run via flush_rate_totals() in
the same finalize block used by the I1 first-byte probe and emitted via:

- debug_log!(Send, 1, ...) for human output
- tracing::debug!(target = "rsync::generator::flush_rate", ...) when the
  optional tracing feature is enabled

Public API: a new flush_rate_totals() free function in the generator
module. No CLI flag, no wire-format change, no change to the existing
hot-path function signatures.

Two unit tests cover the counter behaviour:

- flush_with_count_increments_global_counter asserts the counter grows
  by at least N after N flush_with_count() calls (>= guards against
  concurrent test runs incrementing the shared counter)
- flush_rate_totals_is_observable_without_flushing asserts the counter
  does not move when only the snapshot reader is called, confirming
  constructing a generator does not bump the counter on its own

upstream: sender.c send_files() per-iteration io_flush before recv_ndx

Closes #2198

* ci: trigger workflow

* ci: trigger workflow
oferchen added a commit that referenced this pull request May 18, 2026
* feat(transfer): instrument writer.flush rate (INC_RECURSE I3)

Adds INC_RECURSE diagnostic counter I3 (#2198): a process-global
AtomicU64 that tracks every writer.flush() invocation on the generator
transfer hot path so operators can quantify flush-per-file and
flush-per-batch overhead under inc_recursive sends.

The counter is bumped from a single flush_with_count() helper, replacing
the five hot-path writer.flush() sites in run_transfer_loop():

- per-iteration flush before reading the next NDX request
- NDX_DONE echo on the INC_RECURSE flist-free path
- NDX_DONE echo on phase transitions
- per-file flush on the dry-run write path
- final NDX_DONE goodbye flush at end of loop

End-of-loop, end-of-transfer flushes outside the hot path (send_stats,
handle_goodbye, the pre-recv_filter_list flush in run()) are left
untouched - they fire at most once per transfer and would dilute the
per-file ratio.

Totals are sampled in GeneratorContext::run via flush_rate_totals() in
the same finalize block used by the I1 first-byte probe and emitted via:

- debug_log!(Send, 1, ...) for human output
- tracing::debug!(target = "rsync::generator::flush_rate", ...) when the
  optional tracing feature is enabled

Public API: a new flush_rate_totals() free function in the generator
module. No CLI flag, no wire-format change, no change to the existing
hot-path function signatures.

Two unit tests cover the counter behaviour:

- flush_with_count_increments_global_counter asserts the counter grows
  by at least N after N flush_with_count() calls (>= guards against
  concurrent test runs incrementing the shared counter)
- flush_rate_totals_is_observable_without_flushing asserts the counter
  does not move when only the snapshot reader is called, confirming
  constructing a generator does not bump the counter on its own

upstream: sender.c send_files() per-iteration io_flush before recv_ndx

Closes #2198

* ci: trigger workflow

* ci: trigger workflow
oferchen added a commit that referenced this pull request Aug 24, 2026
* feat(transfer): instrument writer.flush rate (INC_RECURSE I3)

Adds INC_RECURSE diagnostic counter I3 (#2198): a process-global
AtomicU64 that tracks every writer.flush() invocation on the generator
transfer hot path so operators can quantify flush-per-file and
flush-per-batch overhead under inc_recursive sends.

The counter is bumped from a single flush_with_count() helper, replacing
the five hot-path writer.flush() sites in run_transfer_loop():

- per-iteration flush before reading the next NDX request
- NDX_DONE echo on the INC_RECURSE flist-free path
- NDX_DONE echo on phase transitions
- per-file flush on the dry-run write path
- final NDX_DONE goodbye flush at end of loop

End-of-loop, end-of-transfer flushes outside the hot path (send_stats,
handle_goodbye, the pre-recv_filter_list flush in run()) are left
untouched - they fire at most once per transfer and would dilute the
per-file ratio.

Totals are sampled in GeneratorContext::run via flush_rate_totals() in
the same finalize block used by the I1 first-byte probe and emitted via:

- debug_log!(Send, 1, ...) for human output
- tracing::debug!(target = "rsync::generator::flush_rate", ...) when the
  optional tracing feature is enabled

Public API: a new flush_rate_totals() free function in the generator
module. No CLI flag, no wire-format change, no change to the existing
hot-path function signatures.

Two unit tests cover the counter behaviour:

- flush_with_count_increments_global_counter asserts the counter grows
  by at least N after N flush_with_count() calls (>= guards against
  concurrent test runs incrementing the shared counter)
- flush_rate_totals_is_observable_without_flushing asserts the counter
  does not move when only the snapshot reader is called, confirming
  constructing a generator does not bump the counter on its own

upstream: sender.c send_files() per-iteration io_flush before recv_ndx

Closes #2198

* ci: trigger workflow

* ci: trigger workflow
oferchen added a commit that referenced this pull request Aug 24, 2026
* feat(transfer): instrument writer.flush rate (INC_RECURSE I3)

Adds INC_RECURSE diagnostic counter I3 (#2198): a process-global
AtomicU64 that tracks every writer.flush() invocation on the generator
transfer hot path so operators can quantify flush-per-file and
flush-per-batch overhead under inc_recursive sends.

The counter is bumped from a single flush_with_count() helper, replacing
the five hot-path writer.flush() sites in run_transfer_loop():

- per-iteration flush before reading the next NDX request
- NDX_DONE echo on the INC_RECURSE flist-free path
- NDX_DONE echo on phase transitions
- per-file flush on the dry-run write path
- final NDX_DONE goodbye flush at end of loop

End-of-loop, end-of-transfer flushes outside the hot path (send_stats,
handle_goodbye, the pre-recv_filter_list flush in run()) are left
untouched - they fire at most once per transfer and would dilute the
per-file ratio.

Totals are sampled in GeneratorContext::run via flush_rate_totals() in
the same finalize block used by the I1 first-byte probe and emitted via:

- debug_log!(Send, 1, ...) for human output
- tracing::debug!(target = "rsync::generator::flush_rate", ...) when the
  optional tracing feature is enabled

Public API: a new flush_rate_totals() free function in the generator
module. No CLI flag, no wire-format change, no change to the existing
hot-path function signatures.

Two unit tests cover the counter behaviour:

- flush_with_count_increments_global_counter asserts the counter grows
  by at least N after N flush_with_count() calls (>= guards against
  concurrent test runs incrementing the shared counter)
- flush_rate_totals_is_observable_without_flushing asserts the counter
  does not move when only the snapshot reader is called, confirming
  constructing a generator does not bump the counter on its own

upstream: sender.c send_files() per-iteration io_flush before recv_ndx

Closes #2198

* ci: trigger workflow

* ci: trigger workflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant