‹ back home

Soju failing with "too many open files"

2025-01-09 #notes #openbsd #soju

From the logs (wrapped for readability):

Jan 9 14:52:37 anchor soju[71321]: 2025/01/09 14:52:37 listener 0.0.0.0:6697: accept error (retrying in 1s): accept tcp 0.0.0.0:6697: accept4: too many open files

Sounds like soju needs more file descriptors that the current limit. I need to increase the maximum allowed file descriptors.

The fix

First, give the _soju user a dedicated class:

-_soju:*:895:895::0:0:soju user:/var/soju:/sbin/nologin
+_soju:*:895:895:soju:0:0:soju user:/var/soju:/sbin/nologin

Then raise the limit for this class by creating /etc/login.conf.d/soju:

soju:\
        :openfiles-max=4096:\
        :openfiles-cur=128:\
        :tc=default:

Finally, rebuild the capability database and restart soju:

cap_mkdb /etc/login.conf
rcctl restart soju

Sources

Have comments or want to discuss this topic?
Send an email to my public inbox: ~whynothugo/public-inbox@lists.sr.ht.
Or feel free to reply privately by email: hugo@whynothugo.nl.

— § —