* [PATCH 6/6] daemon: share FDs for identical log paths
2022-08-01 21:24 5% [PATCH 0/6] flesh out more -netd funcionality Eric Wong
@ 2022-08-01 21:24 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2022-08-01 21:24 UTC (permalink / raw)
To: meta
We rely on the %logs hash for SIGUSR1 log reopening. Without this sharing,
some FDs would be hidden inside its respective {HTTP,IMAP,POP3}D
object and not reopened on USR2
---
lib/PublicInbox/Daemon.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index ead5afc0..20b07b83 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -104,6 +104,7 @@ sub open_log_path ($$) { # my ($fh, $path) = @_; # $_[0] is modified
open $_[0], '>>', $_[1] or die "open(>> $_[1]): $!";
$_[0]->autoflush(1);
do_chown($_[1]);
+ $_[0];
}
sub load_mod ($;$$) {
@@ -141,8 +142,7 @@ sub load_mod ($;$$) {
die "multiple $f= options specified\n" if @$p > 1;
check_absolute("$f=", $p->[0]) if $daemonize;
$p = File::Spec->canonpath($p->[0]);
- open_log_path(my $fh, $p);
- $tlsd->{$f} = $logs{$p} = $fh;
+ $tlsd->{$f} = $logs{$p} //= open_log_path(my $fh, $p);
warn "# $scheme://$addr $f=$p\n";
}
\%xn;
^ permalink raw reply related [relevance 7%]
* [PATCH 0/6] flesh out more -netd funcionality
@ 2022-08-01 21:24 5% Eric Wong
2022-08-01 21:24 7% ` [PATCH 6/6] daemon: share FDs for identical log paths Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2022-08-01 21:24 UTC (permalink / raw)
To: meta
These changes will allow public-inbox-netd to host multiple,
completely-unrelated .psgi apps within the same process via
psgi= as a per-listener option. Having separate stdout/stderr
facsimiles is also supported via err= and out= keys (HTTP(S)
only has err= for $env->{'psgi.errors'}).
(public-inbox-{nntp,imap,pop3,http}d can actually do all that
-netd can do, too, the only difference is -netd has no default
port/protocol).
Further optimizations (PublicInbox::Config object sharing)
and reload improvements (TLS cert reload on SIGHUP) are on
the way...
Eric Wong (6):
httpd: make internals slightly more generic
daemon: support per-listener env, .psgi, out, err
daemon: require absolute cert/key paths with --daemonize
daemon: add diagnostics about inherited/bound listeners
daemon: allow listening on well-known ports based on protocol
daemon: share FDs for identical log paths
Documentation/public-inbox-daemon.pod | 51 ++++++--
Documentation/public-inbox-netd.pod | 34 ++++--
MANIFEST | 1 +
lib/PublicInbox/Daemon.pm | 168 +++++++++++++++++---------
lib/PublicInbox/HTTP.pm | 10 +-
lib/PublicInbox/HTTPD.pm | 60 +++++----
lib/PublicInbox/IMAPD.pm | 3 +-
lib/PublicInbox/NNTPD.pm | 25 ++--
lib/PublicInbox/POP3D.pm | 36 +++---
t/alt.psgi | 17 +++
t/httpd-corner.psgi | 8 +-
t/httpd-corner.t | 39 +++++-
12 files changed, 304 insertions(+), 148 deletions(-)
create mode 100644 t/alt.psgi
^ permalink raw reply [relevance 5%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2022-08-01 21:24 5% [PATCH 0/6] flesh out more -netd funcionality Eric Wong
2022-08-01 21:24 7% ` [PATCH 6/6] daemon: share FDs for identical log paths Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).