Bitbucket Smart Mirror repositories fail to synchronize with Bad configuration option: AddKeysToAgent
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
After upgrading a Bitbucket Mirror to a version => 7.9, the repositories stop synchronizing and fetching changes, even if the mirror is reported as SYNCHRONIZED.
Environment
Bitbucket DC Mirror mode v.7.9+
Linux
OpenSSH < v7.2 on the mirror
Diagnosis
The following appears in the mirror logs:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
xxxxxxxxx ERROR [farm-refchange-poller:thread-1] @xxxxxxx c.a.b.i.m.m.f.q.FarmRequestRetryingProcessor Request DefaultFarmQueueRequest{value=FarmSynchronizationRequest{externalRepositoryId=16, type=incremental}, attempt=6} exhausted retries (5) message: [Exception while processing an event for repository[16]:]
java.lang.RuntimeException: Unexpected error generating a list of changes
at com.atlassian.bitbucket.internal.mirroring.mirror.farm.refchange.RefChangeCalculator.remoteDiff(RefChangeCalculator.java:138)
at com.atlassian.bitbucket.internal.mirroring.mirror.farm.synchronization.FarmOrchestrator.calculateRefChanges(FarmOrchestrator.java:124)
at com.atlassian.bitbucket.internal.mirroring.mirror.farm.synchronization.FarmOrchestrator.lambda$orchestrateChanges$0(FarmOrchestrator.java:96)
at com.atlassian.bitbucket.internal.mirroring.mirror.repository.DefaultRepositoryLockCallback.onLockSuccess(DefaultRepositoryLockCallback.java:45)
at com.atlassian.bitbucket.internal.mirroring.mirror.repository.MirrorRepositoryLockService.performUsingLock(MirrorRepositoryLockService.java:86)
at com.atlassian.bitbucket.internal.mirroring.mirror.farm.synchronization.FarmOrchestrator.orchestrateChanges(FarmOrchestrator.java:88)
at com.atlassian.bitbucket.internal.mirroring.mirror.farm.FarmQueueProcessorWiring.lambda$refChangesQueueProcessor$1(FarmQueueProcessorWiring.java:50)
at com.atlassian.bitbucket.internal.mirroring.mirror.farm.queue.FarmRequestLockRetryingProcessor.process(FarmRequestLockRetryingProcessor.java:42)
at com.atlassian.bitbucket.internal.mirroring.mirror.farm.queue.FarmRequestRetryingProcessor.process(FarmRequestRetryingProcessor.java:50)
at com.atlassian.bitbucket.internal.mirroring.mirror.mdc.FarmRequestStateTransferringProcessor.process(FarmRequestStateTransferringProcessor.java:25)
at com.atlassian.bitbucket.internal.mirroring.mirror.farm.queue.FarmQueuePoller$QueuePollerTask.run(FarmQueuePoller.java:86)
at com.atlassian.sal.core.executor.ThreadLocalDelegateRunnable.run(ThreadLocalDelegateRunnable.java:34)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.lang.Thread.run(Thread.java:748)
... 1 frame trimmed
Caused by: java.util.concurrent.ExecutionException: com.atlassian.bitbucket.scm.CommandFailedException: '/usr/local/git/bin/git ls-remote --refs ssh://git@<BASE_URL>/<PROJECT>/<REPO>.git' exited with code 128 saying: command-line: line 0: Bad configuration option: AddKeysToAgent
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1908)
at com.atlassian.bitbucket.internal.mirroring.mirror.farm.refchange.RefChangeCalculator.remoteDiff(RefChangeCalculator.java:134)
... 16 common frames omitted
Caused by: com.atlassian.bitbucket.scm.CommandFailedException: '/usr/local/git/bin/git ls-remote --refs ssh://git@<BASE_URL>:7999/<PROJECT>/<REPO>.git' exited with code 128 saying: command-line: line 0: Bad configuration option: AddKeysToAgent
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
at com.atlassian.bitbucket.scm.DefaultCommandExitHandler.onError(DefaultCommandExitHandler.java:47)
at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.evaluateThrowable(GitCommandExitHandler.java:111)
at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.onError(GitCommandExitHandler.java:208)
at com.atlassian.bitbucket.scm.DefaultCommandExitHandler.onExit(DefaultCommandExitHandler.java:32)
at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.callExitHandler(NioNuProcessHandler.java:286)
at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.finish(NioNuProcessHandler.java:327)
at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.onExit(NioNuProcessHandler.java:119)
at com.atlassian.bitbucket.internal.process.nu.LatchedNioNuProcessHandler.onExit(LatchedNioNuProcessHandler.java:38)
at com.zaxxer.nuprocess.internal.BasePosixProcess.onExit(BasePosixProcess.java:307)
at com.zaxxer.nuprocess.linux.ProcessEpoll.handleExit(ProcessEpoll.java:371)
at com.zaxxer.nuprocess.linux.ProcessEpoll.cleanupProcess(ProcessEpoll.java:334)
at com.zaxxer.nuprocess.linux.ProcessEpoll.process(ProcessEpoll.java:272)
at com.zaxxer.nuprocess.internal.BaseEventProcessor.run(BaseEventProcessor.java:81)
at com.zaxxer.nuprocess.linux.ProcessEpoll.run(ProcessEpoll.java:188)
at com.zaxxer.nuprocess.linux.LinuxProcess.run(LinuxProcess.java:107)
at com.zaxxer.nuprocess.linux.LinProcessFactory.runProcess(LinProcessFactory.java:50)
at com.zaxxer.nuprocess.NuProcessBuilder.run(NuProcessBuilder.java:273)
at com.atlassian.stash.internal.concurrent.StateTransferringRunnable.run(StateTransferringRunnable.java:50)
... 3 common frames omitted
Caused by: com.atlassian.utils.process.ProcessException: Non-zero exit code: 128
at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.callExitHandler(NioNuProcessHandler.java:278)
... 16 common frames omitted
Cause
In Bitbucket 7.9 an option AddKeysToAgent was added to the ssh wrapper script. That option was added to OpenSSH only in version OpenSSH 7.2: OpenSSH 7.2 Release Notes
If the server hosting the Mirror is running OpenSSH < 7.2 that option is not available, causing the errors.
Solution
Upgrade the version of OpenSSH on the server hosting the mirror to a version > 7.2
Was this helpful?