Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11“Connection unexpectedly closed” means your local rsync lost its protocol connection to the remote rsync process. It is not a diagnosis of one specific fault. The remote process may never have started, a login shell may have written text into the protocol stream, a daemon may have rejected an option, a timeout may have ended an idle transfer, or the server process may have crashed or been killed. Identify the transport, capture the exit code, test the remote side independently, and then follow the matching branch below.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
What the error actually means
Rsync uses a local process and a remote rsync process that exchange a binary protocol. The connection can use an SSH or other remote-shell command such as host:path, or a directly addressed rsync daemon such as host::module or rsync://. When the local process says the connection was unexpectedly closed, the other end of that protocol conversation has disappeared or become unusable.
As an Amazon Associate I earn from qualifying purchases.
The same event can be printed as rsync error: error in rsync protocol data stream (code 12), or as a broken-pipe write. Those messages identify a lost protocol conversation, not its root cause. A useful investigation therefore starts with the layer that failed rather than with a single presumed fix.
Start with a precise failure record
Before changing configuration, save the complete command and the exact output. A shortened command copied from a script can hide the option or transport that determines the troubleshooting path.
#1 Best Overall
- Copy the complete rsync command, including all options, the source, destination, and whether it runs from a script, scheduler, container, or interactive shell.
- Record the local and remote rsync versions. Version differences matter particularly when a remote daemon parses options differently from a modern client.
- Note when the disconnect occurs: before any transfer, during negotiation, after some files have copied, or after a long idle period.
- Save the numeric exit code as well as the human-readable message. Codes 10, 12, 23, 30, and 35 point to different failure layers.
- Write down whether the endpoint is an SSH/remote-shell target (
host:path) or a daemon target (host::moduleorrsync://).
Do not infer a daemon problem from an SSH command or an SSH problem from a daemon URL. The two transports start the remote side differently and require different evidence.
Make remote diagnostics visible
A remote failure can be hidden inside the stream that rsync is using for file data. The Rsync Project recommends sending messages to standard error with --msgs2stderr -M--msgs2stderr where the installed versions support those options. The first option affects the local side; the -M form asks the remote rsync to use the same behavior.
Recommended Free Tools
rsync --msgs2stderr -M--msgs2stderr [your existing options] source host:path
Run the diagnostic form without removing unrelated options. If the remote process reports a missing executable, an access failure, or an option error on standard error, that message is more actionable than a generic protocol-stream error. If an older version rejects the diagnostic option, repeat the test without it and rely on the transport-specific checks below.
When the command uses SSH or another remote shell
An SSH-style command normally causes the local rsync to start a remote shell, which in turn starts rsync on the other host. The remote shell must be quiet and must successfully execute the requested rsync command.
1. Test the shell without rsync
Use the same host and account that the transfer uses:
ssh remotehost /bin/true > out.dat
If the remote shell is functioning correctly, out.dat should have zero length. Check it directly:
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #2
wc -c < out.dat
A non-empty file is strong evidence that something in the non-interactive login path printed text. Typical sources include .profile, .cshrc, or another startup script. A banner, diagnostic echo, command-not-found message, or other text arrives where rsync expects protocol bytes and can cause code 12 or a broken pipe.
Remove or conditionally suppress that output for non-interactive sessions. Keep normal prompts and human-facing messages for interactive shells, but ensure a non-interactive SSH invocation used by automation emits nothing unless the command itself writes output. Repeat the /bin/true test until the redirected file is empty, then retry rsync.
2. Verify that the remote rsync can start
Use the same account and host to check the executable and its search path. A shell that connects successfully can still fail when it cannot find or execute rsync.
ssh remotehost 'command -v rsync'
ssh remotehost 'rsync --version'
If the account has a restricted PATH, the interactive shell may find rsync while the non-interactive shell cannot. Use the absolute rsync path in the remote command or correct the account’s non-interactive environment, according to the server’s policy. The local and remote versions should both be recorded before changing anything; a version mismatch is not automatically an error, but it is important context when an option is rejected.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsAlso confirm that the account is permitted to run rsync. Forced commands, restricted shells, service accounts, and policy tools can accept an SSH connection while refusing the requested program. The refusal may be printed by the shell or policy layer and then appear locally as a protocol failure.
3. Check the path and permissions separately
Test the source and destination with the same account outside the transfer. The remote process can exit immediately if it cannot read the source, create the destination, traverse a parent directory, or access a required filesystem.
ssh remotehost 'test -r /path/to/source'
ssh remotehost 'test -x /path/to/destination-parent'
ssh remotehost 'test -w /path/to/destination'
Replace the paths with the actual locations and interpret a nonzero result as a permissions or path problem to fix before rerunning rsync. A destination can exist but still be unusable because the account lacks write permission or search permission on a parent directory. For a source, read permission on the file is not enough if the account cannot traverse the directory tree.
4. Look for shell output introduced by a command wrapper
Some deployments invoke rsync through a wrapper, a login shell option, or a remote command configured in SSH. Any wrapper must execute rsync and remain silent. Log messages, environment dumps, debugging echo commands, and error text on standard output corrupt the protocol just as a profile banner does. Redirect intentional diagnostics to standard error, and make sure a successful startup does not print a heading or status line.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →When the command uses an rsync daemon
Daemon connections use host::module or rsync:// rather than starting rsync through SSH. The daemon itself accepts the connection, selects a module, validates options and access controls, and then serves or receives data.
Inspect the daemon log first
For a daemon failure, the server log is usually more informative than the client’s “connection unexpectedly closed” line. Look for:
- an option the daemon refused or could not parse;
- a module configured as read-only when the operation attempts to write;
- an access-control, authentication, or host-allow/deny decision;
- a missing or inaccessible module path;
- an immediate daemon exit, crash, or resource failure.
Older daemon versions could hide option errors from clients, leaving only a generic disconnect on the local side. If the log shows that behavior and the daemon is obsolete, upgrading it is a remediation to evaluate after confirming compatibility with the server configuration and client versions.
Separate network reachability from module authorization
A connection that reaches the daemon is not proof that the requested module is usable. Test the exact daemon endpoint and module, then compare the result with the daemon log. A refused module, a read-only setting, or an access rule can close the session during negotiation, before any file data is transferred.
Do not apply SSH startup-file changes to a daemon-only failure: no remote login shell is involved in that path. Conversely, a clean daemon log does not prove that an SSH remote shell is clean.
Use timing to choose the next test
The point at which the connection closes narrows the likely layer. Treat timing as a branch point, not as proof of a single cause.
Rank #4
| Failure timing | Likely layer to inspect | Next evidence |
|---|---|---|
| Before any bytes or immediately after connection | Remote command startup, shell output, executable availability, daemon authorization, or option parsing | Run the independent SSH test, verify remote rsync, or inspect the daemon log |
| During negotiation | Protocol corruption, rejected options, incompatible or obsolete daemon behavior, or a remote process that exits | Enable diagnostic messages, record both versions, and check server-side logs |
| After some files have transferred | Permission or storage error, process termination, network interruption, or resource limit | Check the remote process and system logs, filesystem state, and the exact exit code |
| After a long lull | Idle connection closure or an unsuitable timeout | Review --timeout, link and firewall idle policies, and keep-alive behavior |
Interpret the rsync exit code
The numeric code identifies the layer that reported failure, but it does not by itself identify the underlying cause. Use it to select evidence rather than to skip the transport checks.
| Code | Meaning | What to investigate |
|---|---|---|
| 10 | Socket I/O error | Network interruption, socket failure, or the peer disappearing at the transport layer |
| 12 | Error in the rsync protocol data stream | Remote process exit, shell output contaminating the stream, rejected startup, or another protocol-level interruption |
| 23 | Partial transfer due to error | Which files failed, their permissions and paths, and whether the remote process or storage failed after the transfer began |
| 30 | Timeout in data send/receive | Idle or stalled data transfer and the value of --timeout relative to the workload and link |
| 35 | Timeout waiting for a daemon connection | Daemon reachability, listener state, network path, and connection-timeout settings |
A code 12 accompanied by a non-empty out.dat points strongly toward shell startup output, while code 30 or 35 directs attention to timeout behavior. A code 23 requires examining the partial-transfer details rather than assuming the connection itself was the only problem.
Fix idle connections and broken-pipe symptoms
An apparently healthy link can still lose an rsync session if no data crosses it for long enough. Firewalls, proxies, NAT devices, or the peer may close an idle connection. The rsync project notes that newer versions can send keep-alive messages during lulls; behavior depends on the versions and options in use.
Set a suitable --timeout for the network and workload:
rsync --timeout=SECONDS [your existing options] source host:path
Choose a value that exceeds the longest expected pause while still detecting a genuinely stalled transfer. A very short value can terminate a slow but valid operation; an excessively long value delays detection and recovery. Code 30 indicates a timeout while sending or receiving data, whereas code 35 indicates that a daemon connection was not established in time. Those are different stages and should not be treated interchangeably.
A “broken pipe” write generally means the local side attempted to write after the other process or network path had closed. Check why the peer exited first: shell contamination, a daemon refusal, a remote crash, or a timeout. Increasing a timeout without finding an immediate remote exit will not repair the protocol.
Best Value
Investigate a remote process that exits or crashes
If the SSH startup test is clean, the remote executable exists, permissions are correct, and the daemon log does not show a normal refusal, inspect the server at the moment of failure.
- Review operating-system logs for an out-of-memory kill, process termination, service restart, or kernel-level storage error.
- Check memory pressure, process and file-descriptor limits, CPU or cgroup limits, and available filesystem space.
- Inspect the rsync daemon log if the daemon process is involved.
- Look for read errors, failing storage, or a destination filesystem that has become unavailable.
- Compare the time of the local disconnect with the server’s event timestamps.
When a daemon-side crash must be isolated, the Rsync Project’s troubleshooting guidance recommends running the daemon in the foreground with tracing. Use that mode only in a controlled maintenance window or a dedicated test instance, because foreground operation and verbose tracing can change service behavior and produce substantial logs. The trace should show whether the daemon exits while parsing options, opening a module, reading a file, or transferring data.
A complete recovery sequence
Use this ordered procedure when the cause is not obvious. Stop at the first step that produces a concrete fault, fix that fault, and then repeat the original transfer.
- Save the exact invocation. Include the full command, both rsync versions, transport form, exit code, and the point at which the disconnect occurs.
- Expose diagnostics. Add
--msgs2stderr -M--msgs2stderrwhere supported and preserve the resulting standard-error output. - Choose the transport branch. Use the SSH checks for
host:path; use daemon logs and module checks forhost::moduleorrsync://. - For SSH, run the zero-output test. Execute
ssh remotehost /bin/true > out.datwith the same account and verify that the file is empty. - For SSH, verify startup. Confirm that the account can locate and execute rsync, that any wrapper is silent, and that the source or destination path is accessible.
- For a daemon, inspect server evidence. Check option parsing, module mode, access rules, path availability, and whether the daemon exited.
- Classify the exit code. Use codes 10, 12, 23, 30, and 35 to select socket, protocol, partial-transfer, data-timeout, or daemon-connection evidence.
- Check idle behavior. If the failure follows a lull, set a workload-appropriate
--timeoutand account for keep-alive support in the installed versions. - Inspect the server for unexplained termination. Correlate system and daemon logs with the client timestamp; use a foreground traced daemon for a reproducible daemon crash.
- Retry the smallest safe transfer. Once the fault is corrected, test a limited source or destination first, then run the full job. Keep the successful command and diagnostic output with the job documentation.
Common wrong turns
Assuming every code 12 is a network outage
Code 12 names a protocol data-stream error. A login shell that prints one line can produce it even when SSH networking is perfect. Run the redirected /bin/true test before changing routes, keys, or firewall rules.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Testing with a different account or host
Shell startup files, PATH values, permissions, forced commands, and module access are account-specific. A successful test from an administrator account does not validate the service account used by the failing job.
Changing timeout values for an immediate disconnect
A timeout cannot fix a remote command that exits during startup or a daemon that rejects an option. First determine whether the failure occurs before data transfer or only after an idle interval.
Ignoring the server because the client printed an error
The client can only report that its peer vanished. When the remote process is killed, crashes, or refuses a module, the decisive evidence is in the remote system or daemon logs.
Leaving diagnostic output enabled without checking its destination
Diagnostics should go to standard error, not into the protocol data stream. After troubleshooting, review scripts and wrappers so temporary output does not become a permanent source of corruption or noisy logs.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Prevent the error from returning
- Keep non-interactive shell startup silent and test it after profile changes.
- Document the absolute path to rsync when service accounts have restricted environments.
- Record the local and remote versions alongside the transfer configuration.
- Keep daemon configuration, module permissions, and access rules under change control.
- Set
--timeoutbased on measured pauses and the network’s idle policies rather than copying an arbitrary value. - Monitor server memory, storage, process limits, and daemon restarts for scheduled transfers.
- Retain the complete command and exit code in job logs so a future failure can be classified immediately.
The practical distinction is simple: SSH transfers require a silent, executable remote shell command; daemon transfers require a healthy, authorized daemon and module. In both cases, the local message only tells you that the protocol peer is gone. The transport, timing, exit code, and server evidence tell you why.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




