Skip to content

Set open FD limits

Matthias Käppler requested to merge 65-set-ulimits into master

Not setting these means Docker containers will inherit whatever is set in the Docker dameon, which can vary from env to env.

These values can have a very high cap and have caused problems with memory allocations in #65 (closed)

I verified this fix via:

Set high limits for dockerd:

cat /etc/docker/daemon.json
{
  "default-ulimits": {
    "nofile": {
      "Hard": 1041312256,
      "Name": "nofile",
      "Soft": 1041312256
    }
  }
}

Run a Rails console then:

$ make shell
cat /proc/64/limits | grep 'open files'
Max open files            1024                 64000                files 

smem -P ruby
  PID User     Command                         Swap      USS      PSS      RSS 
20229 git      /usr/bin/python3 /usr/bin/s        0    12340    13154    14760 
   64 git      ruby /home/git/gitlab/bin/r        0   459164   460275   462240 

Closes #65 (closed)

Merge request reports