Gerrit无法加载"启动Gerrit Code Review:FAILED"日志中没有错误

时间:2016-04-29 20:53:42

标签: java mysql gerrit

我根据Standalone Daemon Installation Guide和MySQL安装了Gerrit。所有插件都与Gerrit安装2.12.2相匹配。

使用〜/ gerrit_install / bin / gerrit.sh启动Gerrit时,输出就是:

启动Gerrit代码审核:失败

〜/ gerrit_install / logs / error_log

中没有错误

如果我将gerrit.sh修改为#!/ bin / sh -x并在gerrit.sh中运行,我会看到:

# bin/gerrit.sh start
+ test 1 -gt 0
+ ACTION=start
+ shift
+ test 0 -gt 0
+ test -z
+ NO_START=0
+ test -z
+ START_STOP_DAEMON=1
+ test -f /etc/default/gerritcodereview
+ test -z
+ TMP=/tmp
+ TMPJ=/tmp/j4726
+ GERRIT_INSTALL_TRACE_FILE=etc/gerrit.config
+ type git
+ : OK
+ test -z
+ dirname bin/gerrit.sh
+ GERRIT_SITE_1=bin/..
+ test -f bin/../etc/gerrit.config
+ GERRIT_SITE=bin/..
+ test -z bin/..
+ pwd
+ INITIAL_DIR=/home/gerrit2/gerrit_install
+ cd bin/..
+ pwd
+ GERRIT_SITE=/home/gerrit2/gerrit_install
+ GERRIT_CONFIG=/home/gerrit2/gerrit_install/etc/gerrit.config
+ test -f /home/gerrit2/gerrit_install/etc/gerrit.config
+ test -r /home/gerrit2/gerrit_install/etc/gerrit.config
+ GERRIT_PID=/home/gerrit2/gerrit_install/logs/gerrit.pid
+ GERRIT_RUN=/home/gerrit2/gerrit_install/logs/gerrit.run
+ GERRIT_TMP=/home/gerrit2/gerrit_install/tmp
+ export GERRIT_TMP
+ JAVA_HOME_OLD=
+ get_config --get container.javaHome
+ test -f /home/gerrit2/gerrit_install/etc/gerrit.config
+ test x--get = x--int
+ git config --file /home/gerrit2/gerrit_install/etc/gerrit.config --get container.javaHome
+ JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre
+ test -z /usr/lib/jvm/java-7-openjdk-amd64/jre
+ test -z /usr/lib/jvm/java-7-openjdk-amd64/jre
+ test -z  -a -n /usr/lib/jvm/java-7-openjdk-amd64/jre -a -x /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -a ! -d /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
+ JAVA=/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
+ test -z /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
+ test -z
+ JSTACK=/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/jstack
+ get_config --get-all container.javaOptions
+ test -f /home/gerrit2/gerrit_install/etc/gerrit.config
+ test x--get-all = x--int
+ git config --file /home/gerrit2/gerrit_install/etc/gerrit.config --get-all container.javaOptions
+ GERRIT_OPTIONS=
+ test -n
+ get_config --get container.heapLimit
+ test -f /home/gerrit2/gerrit_install/etc/gerrit.config
+ test x--get = x--int
+ git config --file /home/gerrit2/gerrit_install/etc/gerrit.config --get container.heapLimit
+ GERRIT_MEMORY=
+ test -n
+ get_config --int core.packedGitOpenFiles
+ test -f /home/gerrit2/gerrit_install/etc/gerrit.config
+ test x--int = x--int
+ git config --file /home/gerrit2/gerrit_install/etc/gerrit.config --int core.packedGitOpenFiles
+ n=
+ test x0 = x
+ echo
+ GERRIT_FDS=
+ test -z
+ GERRIT_FDS=128
+ expr 128 + 128
+ GERRIT_FDS=256
+ test 256 -lt 1024
+ GERRIT_FDS=1024
+ get_config --get container.user
+ test -f /home/gerrit2/gerrit_install/etc/gerrit.config
+ test x--get = x--int
+ git config --file /home/gerrit2/gerrit_install/etc/gerrit.config --get container.user
+ GERRIT_USER=gerrit2
+ ulimit -c 0
+ ulimit -d unlimited
+ ulimit -f unlimited
+ ulimit -m
+ ulimit -m unlimited
+ ulimit -n 1024
+ ulimit -t unlimited
+ ulimit -v unlimited
+ ulimit -x
+ test -z
+ get_config --get container.war
+ test -f /home/gerrit2/gerrit_install/etc/gerrit.config
+ test x--get = x--int
+ git config --file /home/gerrit2/gerrit_install/etc/gerrit.config --get container.war
+ GERRIT_WAR=
+ test -z
+ GERRIT_WAR=/home/gerrit2/gerrit_install/bin/gerrit.war
+ test -f /home/gerrit2/gerrit_install/bin/gerrit.war
+ test -z /home/gerrit2/gerrit_install/bin/gerrit.war -a -n gerrit2
+ test -z /home/gerrit2/gerrit_install/bin/gerrit.war
+ test -z gerrit2
+ RUN_ARGS=-jar /home/gerrit2/gerrit_install/bin/gerrit.war daemon -d /home/gerrit2/gerrit_install
+ get_config --bool container.slave
+ test -f /home/gerrit2/gerrit_install/etc/gerrit.config
+ test x--bool = x--int
+ git config --file /home/gerrit2/gerrit_install/etc/gerrit.config --bool container.slave
+ test  = true
+ get_config --get-all container.daemonOpt
+ test -f /home/gerrit2/gerrit_install/etc/gerrit.config
+ test x--get-all = x--int
+ git config --file /home/gerrit2/gerrit_install/etc/gerrit.config --get-all container.daemonOpt
+ DAEMON_OPTS=
+ test -n
+ test -n
+ test -x /usr/bin/perl
+ export JAVA
+ RUN_EXEC=/usr/bin/perl
+ RUN_Arg1=-e
+ RUN_Arg2=$x=$ENV{JAVA};exec $x @ARGV;die $!
+ RUN_Arg3=-- GerritCodeReview
+ printf %s Starting Gerrit Code Review:
Starting Gerrit Code Review: + test 1 = 0
+ test -z
+ sed -e s/^[^=]*=\([0-9]*\).*/\1/
+ id
+ UID=0
+ date +%s
+ RUN_ID=1461962528.4726
+ RUN_ARGS=-jar /home/gerrit2/gerrit_install/bin/gerrit.war daemon -d /home/gerrit2/gerrit_install --run-id=1461962528.4726
+ test 1 = 1
+ type start-stop-daemon
+ test 0 = 0
+ CH_USER=-c gerrit2
+ start-stop-daemon -S -b -c gerrit2 -p /home/gerrit2/gerrit_install/logs/gerrit.pid -m -d /home/gerrit2/gerrit_install -a /usr/bin/perl -- -e $x=$ENV{JAVA};exec $x @ARGV;die $! -- GerritCodeReview -jar /home/gerrit2/gerrit_install/bin/gerrit.war daemon -d /home/gerrit2/gerrit_install --run-id=1461962528.4726
+ : OK
+ test 0 = 0
+ cat /home/gerrit2/gerrit_install/logs/gerrit.pid
cat: /home/gerrit2/gerrit_install/logs/gerrit.pid: No such file or directory
+ PID=
+ test -f /proc//oom_score_adj
+ test -f /proc//oom_adj
+ TIMEOUT=90
+ sleep 1
+ running /home/gerrit2/gerrit_install/logs/gerrit.pid
+ test -f /home/gerrit2/gerrit_install/logs/gerrit.pid
+ cat /home/gerrit2/gerrit_install/logs/gerrit.pid
+ PID=4755
+ ps -p 4755
+ return 0
+ test 90 -gt 0
+ cat /home/gerrit2/gerrit_install/logs/gerrit.run
+ test x1461962528.4726 = x
+ sleep 2
+ expr 90 - 2
+ TIMEOUT=88
+ running /home/gerrit2/gerrit_install/logs/gerrit.pid
+ test -f /home/gerrit2/gerrit_install/logs/gerrit.pid
+ cat /home/gerrit2/gerrit_install/logs/gerrit.pid
+ PID=4755
+ ps -p 4755
+ return 0
+ test 88 -gt 0
+ cat /home/gerrit2/gerrit_install/logs/gerrit.run
+ test x1461962528.4726 = x
+ sleep 2
+ expr 88 - 2

最后12行循环,直到90秒超时到达结尾。之后出现简单错误FAILED。

gerrit.config

# cat etc/gerrit.config
[gerrit]
    basePath = git
    canonicalWebUrl = http://gerrit.domain.com/
[database]
    type = mysql
    hostname = localhost
    database = reviewdb
    username = gerrit2
[index]
    type = LUCENE
[auth]
    type = HTTP
[receive]
    enableSignedPush = true
[sendemail]
    smtpServer = localhost
[container]
    user = gerrit2
    javaHome = /usr/lib/jvm/java-7-openjdk-amd64/jre
[sshd]
    listenAddress = *:29418
[httpd]
    listenUrl = proxy-http://127.0.0.1:8081/
[cache]
    directory = cache

ps ax | grep gerrit显示:

 4755 ?        Sl     0:10 GerritCodeReview -jar /home/gerrit2/gerrit_install/bin/gerrit.war daemon -d /home/gerrit2/gerrit_install --run-id=1461962528.4726

Apache反向代理似乎正常运行但无法在127.0.0.1:8081上连接:

[Fri Apr 29 16:28:56.820639 2016] [proxy_http:error] [pid 3658:tid 139954109798144] [client 74.56.105.94:49584] AH01114: HTTP: failed to make connection to backend: 127.0.0.1
[Fri Apr 29 16:28:57.573698 2016] [proxy:error] [pid 3658:tid 139954101405440] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:8081 (127.0.0.1) failed
[Fri Apr 29 16:28:57.573766 2016] [proxy:error] [pid 3658:tid 139954101405440] AH00959: ap_proxy_connect_backend disabling worker for (127.0.0.1) for 0s

来自netstat -tlpn的输出

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      992/sshd
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      1158/master
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1064/mysqld
tcp6       0      0 :::80                   :::*                    LISTEN      3655/apache2
tcp6       0      0 :::22                   :::*                    LISTEN      992/sshd
tcp6       0      0 :::25                   :::*                    LISTEN      1158/master
tcp6       0      0 :::443                  :::*                    LISTEN      3655/apache2

我可能遗漏了一些非常明显的东西,但是没有看到它。其他人都有我可能遗失的建议吗?

更新:从最低安装开始,看起来问题出在Bouncy Castle附加组件上。 Gerrit 2.12.2要求v1.52。由于Bouncy Castle仅承载最新版本1.54,因此我使用了Maven.org的jar文件:

http://repo2.maven.org/maven2/org/bouncycastle/bcpkix-jdk15on/1.52/
http://repo2.maven.org/maven2/org/bouncycastle/bcprov-jdk15on/1.52/
http://repo2.maven.org/maven2/org/bouncycastle/bcpg-jdk15on/1.52/

我在询问启用签名推送支持后安装这些内容后,一切都回到了上面的问题。我仍然想知道如何使这个工作

1 个答案:

答案 0 :(得分:2)

问题可能是缺乏熵。 Gerrit从/ dev / random读取,在无头服务器上,在Gerrit有时间启动之前,熵可能会耗尽。

修复可能是安装haveged包。 如果您使用的是RHEL / CentOS / Fedora,则所需命令为:

yum install haveged
chkconfig haveged on
service haveged start

如果您使用的是Debian / Ubuntu,则所需命令为:

apt-get install haveged
update-rc.d haveged defaults
service haveged start

这样做之后,Gerrit应该相对较快地开始。

注意:我已找到此解决方案here