title: Gitlab exceeds numtcpsock beancounter limit (OpenVZ)
body: <p>What is the best way to find out where is the problem with Gitlab (only used application on Ubuntu Plesk Onyx server), that every time I lookup at <code>/proc/user_beancounters</code> the numtcpsock value is on normal state (&lt; 100) and sometimes some Gitlab processes seems to exceed the numtcpsock limit (3000) more than 2300 times, so the virtual server (OpenVZ) crashes?</p>
  
  <p>I already have limited the redis &amp; postgresql connections on <code>/etc/gitlab/gitlab.rb</code>:</p>
  
  <pre><code>postgresql['shared_buffers'] = "30MB"
  postgresql['max_connections'] = 100
  
  redis['maxclients'] = "500"
  redis['tcp_timeout'] = "20"
  redis['tcp_keepalive'] = "10"
  
  sudo gitlab-ctl reconfigure &amp;&amp; sudo gitlab-ctl restart
  </code></pre>
  
  <p>But that seems to don't prevent the server crashes. I need a approach to fix this problem. Have you some ideas?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>The server is only used by about 3-5 people <code>netstat -pnt | wc -l</code> return about 49 tcp connections. <code>cat /proc/user_beancounters</code> <code>numtcpsock</code> 33 at the moment. All of them except my ssh connection listening on local ip.</p>
  
  <p>Here some examples:</p>
  
  <pre><code>tcp        0      0 127.0.0.1:47280         127.0.0.1:9168          TIME_WAIT   -
  tcp        0      0 127.0.0.1:9229          127.0.0.1:34810         TIME_WAIT   -
  tcp        0      0 127.0.0.1:9100          127.0.0.1:45758         TIME_WAIT   -
  tcp        0      0 127.0.0.1:56264         127.0.0.1:8082          TIME_WAIT   -
  tcp        0      0 127.0.0.1:9090          127.0.0.1:43670         TIME_WAIT   -
  tcp        0      0 127.0.0.1:9121          127.0.0.1:41636         TIME_WAIT   -
  tcp        0      0 127.0.0.1:9236          127.0.0.1:42842         TIME_WAIT   -
  tcp        0      0 127.0.0.1:9090          127.0.0.1:43926         TIME_WAIT   -
  tcp        0      0 127.0.0.1:9090          127.0.0.1:44538         TIME_WAIT   -
  </code></pre>
  
  <p>A firewall and fail2ban with many jails (ssh etc) are also active on server.</p>