-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
High
-
None
-
Affects Version/s: 10.2.0
-
Component/s: SSH
-
None
-
1
-
Severity 2 - Major
Issue Summary
Intermittent SSH disconnects during large Git fetches/clones due to re-key race condition in Bitbucket 10.x
In Bitbucket 10.2, Git clients (specifically Jenkins) intermittently experience connection drops when fetching or cloning repositories larger than 1 GB over SSH. The failure consistently occurs around the 1 GB transfer mark, which aligns with the default SSH re-keying threshold.
The server-side logs indicate that the internal Apache MINA SSHD server fails to initialize the key exchange state correctly during a re-key event while data is actively being streamed, leading to an immediate socket closure.
Steps to Reproduce
- Use Bitbucket 10.2.x with SSH enabled.
- Perform a git fetch or git clone on a repository significantly larger than 1 GB.
- Ensure the client uses default SSH re-key settings (typically 1 GB).
- Repeat the operation under load or via automation (Jenkins).
Expected Results
The SSH session should successfully renegotiate keys (re-key) without interrupting the data stream.
Actual Results
The connection is terminated by the remote host.
Client Error: fetch-pack: unexpected disconnect while reading sideband packet, fatal: early EOF.
server Error (Bitbucket logs):
IllegalStateException: X25519 not initialised.
...
java.io.UncheckedIOException: org.apache.sshd.common.SshException: Write attempt on closing session: SSH_MSG_CHANNEL_DATA
Workaround
Increase the server-side SSH re-key byte limit to a value higher than the expected transfer size (e.g., 8 GB) to prevent the re-key from triggering during the fetch.
Add the following JVM property to JVM_SUPPORT_RECOMMENDED_ARGS in the Bitbucket environment configuration and restart the instance:
-Dorg.apache.sshd.config.rekey-bytes-limit=8589934592