unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 4/6] daemon: add diagnostics about inherited/bound listeners
Date: Mon,  1 Aug 2022 21:24:45 +0000	[thread overview]
Message-ID: <20220801212447.270000-5-e@80x24.org> (raw)
In-Reply-To: <20220801212447.270000-1-e@80x24.org>

These are helpful for diagnosing configuration problems,
as well as a bug (to be fixed in the following commit).
---
 lib/PublicInbox/Daemon.pm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index 87a359e7..3264bb6c 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -129,6 +129,7 @@ sub load_mod ($;$) {
 			die "multiple psgi= options specified\n" if @$p > 1;
 			check_absolute('psgi=', $p->[0]) if $daemonize;
 			$tlsd->{psgi} = $p->[0];
+			warn "# $scheme://$addr psgi=$p->[0]\n";
 		}
 	}
 	for my $f (@paths) {
@@ -138,6 +139,7 @@ sub load_mod ($;$) {
 		$p = File::Spec->canonpath($p->[0]);
 		open_log_path(my $fh, $p);
 		$tlsd->{$f} = $logs{$p} = $fh;
+		warn "# $scheme://$addr $f=$p\n";
 	}
 	\%xn;
 }
@@ -247,8 +249,10 @@ EOF
 		warn "error binding $l: $! ($@)\n" unless $s;
 		umask $prev;
 		if ($s) {
-			$listener_names->{sockname($s)} = $s;
 			$s->blocking(0);
+			my $k = sockname($s);
+			warn "# bound $scheme://$k\n";
+			$listener_names->{$k} = $s;
 			push @listeners, $s;
 		}
 	}
@@ -434,11 +438,12 @@ sub inherit ($) {
 		if (my $k = sockname($s)) {
 			my $prev_was_blocking = $s->blocking(0);
 			warn <<"" if $prev_was_blocking;
-Inherited socket (fd=$fd) is blocking, making it non-blocking.
+Inherited socket ($k fd=$fd) is blocking, making it non-blocking.
 Set 'NonBlocking = true' in the systemd.service unit to avoid stalled
 processes when multiple service instances start.
 
 			$listener_names->{$k} = $s;
+			warn "# inherited $k fd=$fd\n";
 			push @rv, $s;
 		} else {
 			warn "failed to inherit fd=$fd (LISTEN_FDS=$fds)";

  parent reply	other threads:[~2022-08-01 21:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01 21:24 [PATCH 0/6] flesh out more -netd funcionality Eric Wong
2022-08-01 21:24 ` [PATCH 1/6] httpd: make internals slightly more generic Eric Wong
2022-08-01 21:24 ` [PATCH 2/6] daemon: support per-listener env, .psgi, out, err Eric Wong
2022-08-01 21:24 ` [PATCH 3/6] daemon: require absolute cert/key paths with --daemonize Eric Wong
2022-08-01 21:24 ` Eric Wong [this message]
2022-08-01 21:24 ` [PATCH 5/6] daemon: allow listening on well-known ports based on protocol Eric Wong
2022-08-01 21:24 ` [PATCH 6/6] daemon: share FDs for identical log paths Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220801212447.270000-5-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).