I often get this kind of issue these years for those gerrit mirror connect to remote db server, the network between them sometime not so stable.
Today after search lots of document, I see this:
My assumption is that:
- Those "java.net.SocketException: Connection timed out" error indicate that the tcp connection is corrupted, but the db client in gerrit cannot detect and drop the db connection, so if I get this kind of timeout issue, the only thing I can do is restart gerrit
- If I change the keepalive timeout value from 7200(ubuntu default) to 60, the tcp connection will auto-detect the corruption and disconnect itself quickly
I have change the value, but need wait some time to see whether it works.
root@gerritserver:~# sysctl -A | grep net.ipv4|grep keep
net.ipv4.tcp_keepalive_intvl = 75
net.ipv4.tcp_keepalive_probes = 9
net.ipv4.tcp_keepalive_time = 7200
root@gerritserver:~# sysctl -w net.ipv4.tcp_keepalive_time=40 net.ipv4.tcp_keepalive_probes=3 net.ipv4.tcp_keepalive_intvl=8
net.ipv4.tcp_keepalive_time = 40
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_keepalive_intvl = 8
在 2015年11月2日星期一 UTC+8上午10:14:29,Chunlin Zhang写道: