Trying to setup replication from gerrit to my github repo. Getting this stacktrace:
[2011-09-20 00:11:58,470] ERROR com.google.gerrit.server.git.PushReplication : Cannot replicate to git@github.com:myuser/myrepo.git
org.eclipse.jgit.errors.TransportException: git@github.com:myuser/myrepo.git: Session.connect: java.net.SocketTimeoutException: Read timed out
at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:138)
at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:121)
at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.(TransportGitSsh.java:248)
at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:147)
at com.google.gerrit.server.git.PushOp.listRemote(PushOp.java:358)
at com.google.gerrit.server.git.PushOp.generateUpdates(PushOp.java:312)
at com.google.gerrit.server.git.PushOp.pushVia(PushOp.java:258)
at com.google.gerrit.server.git.PushOp.runImpl(PushOp.java:213)
at com.google.gerrit.server.git.PushOp.run(PushOp.java:166)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at com.google.gerrit.server.git.WorkQueue$Task.run(WorkQueue.java:324)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)Caused by: com.jcraft.jsch.JSchException: Session.connect: java.net.SocketTimeoutException: Read timed out
at com.jcraft.jsch.Session.connect(Session.java:504)
at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:128)
My config files are as follows:
replication.config:
[remote "github"]
url = git@github.com:myuser/${name}.git
push = +refs/heads/*:refs/heads/*
push = +refs/tags/*:refs/tags/*
timeout = 5
replicationDelay = 0
authGroup = Administrators
secure.config:
[database]
password = secret
[ssh]
file = /home/gerrit2/.ssh/config
.ssh/config:
Host github.com:
IdentityFile ~/.ssh/id_rsa
PreferredAuthentications publickey
I tried running
ssh -i etc/ssh_host_dsa_key git@github.com
ssh -i etc/ssh_host_rsa_key git@github.com
ssh -i ~/.ssh/id_rsa git@github.com
ssh -i ~/.ssh/id_dsa git@github.com
and was able to “hit” github so the keys are imported OK, not sure what the problem is,
any suggestions appreciated.
As the name of the exception
SocketTimeoutExceptionsays (and its documentation details):Looking in the documentation of Gerrit’s replication.config:
Your value is 5 seconds, you could try it with a larger value instead.
(The problem is only indirectly related to JSch – JSch’s
Session.connect(int)will simply take the timeout parameter and pass it on to the Socket it creates. That reminds me that I should document which unit this timeout is for JSch – seconds or milliseconds.)