diff options
| author | grunfink <grunfink@noreply.codeberg.org> | 2026-02-23 05:28:15 +0100 |
|---|---|---|
| committer | grunfink <grunfink@noreply.codeberg.org> | 2026-02-23 05:28:15 +0100 |
| commit | e1e64ac0af3a3b0e15a107e7ca636bc89c63fd47 (patch) | |
| tree | 67091d06b15e04ea30168bd3f41f39c422314c95 | |
| parent | 787d0180bff0655045c3cf42bf8868609c11a6f5 (diff) | |
| parent | 361fdaaa11226554854cb292fe0ed6b372898320 (diff) | |
Merge pull request 'Log xs_socket_accept failure reason and document OpenBSD login class w/ extended openfiles' (#559) from oxzi/snac2:openbsd-openfiles-nfiles into master
Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/559
| -rw-r--r-- | doc/snac.8 | 35 | ||||
| -rwxr-xr-x | examples/snac_openbsd_login_conf | 7 | ||||
| -rw-r--r-- | httpd.c | 5 |
3 files changed, 45 insertions, 2 deletions
@@ -704,6 +704,41 @@ out there. If you want your language file to be included in the standard .Nm distribution, please send me a link to it via the Fediverse to @grunfink@comam.es or make a PR via the Git repository. +.Ss Number of open files on OpenBSD and login classes +Being a file intensive application, even a small +.Nm +instance might open lots of files, especially when forwarding a new post to +other instances. +.Pp +OpenBSD's daemon login class comes with a very low +.Pa openfiles +value, usually restricting the amount of open files to 128 (cur), 1024 (max). +This can result in +.Nm +to stop working due to too many open files. +.Pp +To continue operation, a new +.Pa snac +login class can be created. Please consult +.Xr login.conf 5 +and afterwards create a new login class as follows. +.Bd -literal -offset indent +snac:\\ + :openfiles=4096:\\ + :tc=daemon: +.Ed +.Pp +After rebuilding the +.Pa /etc/login.conf.db , +ensure that your snac user's login class is set to +.Pa snac : +.Bd -literal -offset indent +# cap_mkdb /etc/login.conf +# usermod -L snac SNACUSER +.Ed +.Pp +One restart later, the daemon should run with increased +.Pa openfiles . .Sh ENVIRONMENT .Bl -tag -width Ds .It Ev DEBUG diff --git a/examples/snac_openbsd_login_conf b/examples/snac_openbsd_login_conf new file mode 100755 index 0000000..f39b9a1 --- /dev/null +++ b/examples/snac_openbsd_login_conf @@ -0,0 +1,7 @@ +# OpenBSD login.conf(5) entry to increase the openfiles for the snac login +# class. Further documented under "Number of open files on OpenBSD and login +# classes" in snac(8). + +snac:\ + :openfiles=4096:\ + :tc=daemon: @@ -1116,9 +1116,10 @@ void httpd(void) FILE *f = fdopen(cs, "r+"); xs *job = xs_data_new(&f, sizeof(FILE *)); job_post(job, 1); - } - else + } else { + srv_log(xs_fmt("error: xs_socket_accept failed: %s", strerror(errno))); break; + } } } |