diff options
| -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 | |||
| 704 | .Nm | 704 | .Nm |
| 705 | distribution, please send me a link to it via the Fediverse to @grunfink@comam.es | 705 | distribution, please send me a link to it via the Fediverse to @grunfink@comam.es |
| 706 | or make a PR via the Git repository. | 706 | or make a PR via the Git repository. |
| 707 | .Ss Number of open files on OpenBSD and login classes | ||
| 708 | Being a file intensive application, even a small | ||
| 709 | .Nm | ||
| 710 | instance might open lots of files, especially when forwarding a new post to | ||
| 711 | other instances. | ||
| 712 | .Pp | ||
| 713 | OpenBSD's daemon login class comes with a very low | ||
| 714 | .Pa openfiles | ||
| 715 | value, usually restricting the amount of open files to 128 (cur), 1024 (max). | ||
| 716 | This can result in | ||
| 717 | .Nm | ||
| 718 | to stop working due to too many open files. | ||
| 719 | .Pp | ||
| 720 | To continue operation, a new | ||
| 721 | .Pa snac | ||
| 722 | login class can be created. Please consult | ||
| 723 | .Xr login.conf 5 | ||
| 724 | and afterwards create a new login class as follows. | ||
| 725 | .Bd -literal -offset indent | ||
| 726 | snac:\\ | ||
| 727 | :openfiles=4096:\\ | ||
| 728 | :tc=daemon: | ||
| 729 | .Ed | ||
| 730 | .Pp | ||
| 731 | After rebuilding the | ||
| 732 | .Pa /etc/login.conf.db , | ||
| 733 | ensure that your snac user's login class is set to | ||
| 734 | .Pa snac : | ||
| 735 | .Bd -literal -offset indent | ||
| 736 | # cap_mkdb /etc/login.conf | ||
| 737 | # usermod -L snac SNACUSER | ||
| 738 | .Ed | ||
| 739 | .Pp | ||
| 740 | One restart later, the daemon should run with increased | ||
| 741 | .Pa openfiles . | ||
| 707 | .Sh ENVIRONMENT | 742 | .Sh ENVIRONMENT |
| 708 | .Bl -tag -width Ds | 743 | .Bl -tag -width Ds |
| 709 | .It Ev DEBUG | 744 | .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 @@ | |||
| 1 | # OpenBSD login.conf(5) entry to increase the openfiles for the snac login | ||
| 2 | # class. Further documented under "Number of open files on OpenBSD and login | ||
| 3 | # classes" in snac(8). | ||
| 4 | |||
| 5 | snac:\ | ||
| 6 | :openfiles=4096:\ | ||
| 7 | :tc=daemon: | ||
| @@ -1116,9 +1116,10 @@ void httpd(void) | |||
| 1116 | FILE *f = fdopen(cs, "r+"); | 1116 | FILE *f = fdopen(cs, "r+"); |
| 1117 | xs *job = xs_data_new(&f, sizeof(FILE *)); | 1117 | xs *job = xs_data_new(&f, sizeof(FILE *)); |
| 1118 | job_post(job, 1); | 1118 | job_post(job, 1); |
| 1119 | } | 1119 | } else { |
| 1120 | else | 1120 | srv_log(xs_fmt("error: xs_socket_accept failed: %s", strerror(errno))); |
| 1121 | break; | 1121 | break; |
| 1122 | } | ||
| 1122 | } | 1123 | } |
| 1123 | } | 1124 | } |
| 1124 | 1125 | ||