issue when start Gerit : gerrit.sh ulimit: open files

271 views
Skip to first unread message

Guy Levkowitz

unread,
Jun 7, 2021, 3:09:00 AM6/7/21
to Repo and Gerrit Discussion
Hi

Each time I start Gerrit i get this "warning"  : 
[bin]$ ./gerrit.sh start ./gerrit.sh: line 317: ulimit: open files: cannot modify limit: Operation not permitted

Is there something to do  ?

Björn Pedersen

unread,
Jun 7, 2021, 5:22:27 AM6/7/21
to Repo and Gerrit Discussion
For production usage: start as  root.

Luca Milanesio

unread,
Jun 7, 2021, 1:59:33 PM6/7/21
to Repo and Gerrit Discussion, Luca Milanesio

On 7 Jun 2021, at 10:22, 'Björn Pedersen' via Repo and Gerrit Discussion <repo-d...@googlegroups.com> wrote:

For production usage: start as  root.

Also, if you don’t start Gerrit as root, the Gerrit JVM could be killed at any time by the Linux OOM killer (see [1]).

Luca.




sil...@gmail.com schrieb am Montag, 7. Juni 2021 um 09:09:00 UTC+2:
Hi

Each time I start Gerrit i get this "warning"  : 
[bin]$ ./gerrit.sh start ./gerrit.sh: line 317: ulimit: open files: cannot modify limit: Operation not permitted

Is there something to do  ?


-- 
-- 
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

--- 
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/c28c4fdd-cdc2-4760-83cf-a7d5985b3accn%40googlegroups.com.

Antoine Musso

unread,
Jun 7, 2021, 3:35:10 PM6/7/21
to Guy Levkowitz, Repo and Gerrit Discussion
Assuming I got it right that comes from:

317 ulimit -n $GERRIT_FDS  ; # open files

Which on my Debian defaults to 1024 and is the default limit hardcoded in pam_limits. You should be able to raise it on the system for the gerrit user via a /etc/security/limits.d/gerrit.conf that would have something such as:

 gerrit - nofile 9999

Or alternatively start Gerrit with systemd which has support to set the file limit via Service.LimitNOFile. Our unit (stripped of various irrelevant JVM flags) is:

[Unit]
Description=Gerrit code review tool
After=network.target

[Service]
User=gerrit
Group=gerrit

Type=simple
EnvironmentFile=/etc/default/gerrit
ExecStart=/usr/lib/jvm/java-11-openjdk-amd64/bin/java -jar /var/lib/gerrit2/review_site/bin/gerrit.war daemon -d /var/lib/gerrit2/review_site
KillSignal=SIGINT
# NOFILE :  GERRIT_FDS, determined by "core.packedGitOpenFiles" in the script
LimitNOFILE=20000
Restart=always
RestartSec=2s

[Install]
WantedBy=multi-user.target

-- 
Antoine "hashar" Musso
Release Engineering
Reply all
Reply to author
Forward
0 new messages