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 v2] lei: increase umask timeout
Date: Fri, 30 Aug 2024 19:05:15 +0000	[thread overview]
Message-ID: <20240830190515.M762314@dcvr> (raw)
In-Reply-To: <20240829230544.2108788-1-e@80x24.org>

Eric Wong <e@80x24.org> wrote:
> +	poll_in $sock, 60 or
>  		return send_gently $sock, 'timed out waiting to recv FDs';

Ugh, that should be 60_000 since underlying poll(2) uses milliseconds

> -		$r = poll_in($s, 2) or
> -			die 'timeout waiting for umask';
> +		$r = poll_in $s, 60 or die 'timeout waiting for umask';

ditto

-------8<------
Subject: [PATCH] lei: increase umask timeout

On slow or overloaded systems, 2 seconds may not be sufficient
time to wait for a lei client to respond to the umask request
from lei-daemon.  Use 60s to be consistent with the FD transfer
in the general case.

While we're at it, consistently use poll_in() now that it exists
since it's a better API than vec() + select() and will give
consistent performance regardless of the FD value.
---
 lib/PublicInbox/LEI.pm | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index 637cc8b1..6d072b95 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -1155,8 +1155,7 @@ sub accept_dispatch { # Listener {post_accept} callback
 	my ($sock) = @_; # ignore other
 	$sock->autoflush(1);
 	my $self = bless { sock => $sock }, __PACKAGE__;
-	vec(my $rvec = '', fileno($sock), 1) = 1;
-	select($rvec, undef, undef, 60) or
+	poll_in $sock, 60_000 or
 		return send_gently $sock, 'timed out waiting to recv FDs';
 	# (4096 * 33) >MAX_ARG_STRLEN
 	my @fds = $PublicInbox::IPC::recv_cmd->($sock, my $buf, 4096 * 33) or
@@ -1589,8 +1588,7 @@ sub request_umask { # assumes client is trusted and fast
 	my ($v, $r, $u);
 	do { # n.b. poll_in returns -1 on EINTR
 		vec($v = '', fileno($s), 1) = 1;
-		$r = poll_in($s, 2) or
-			die 'timeout waiting for umask';
+		$r = poll_in $s, 60_000 or die 'timeout waiting for umask';
 	} while ($r < 0 && $! == EINTR);
 	do {
 		$r = recv $s, $v, 5, 0;

      reply	other threads:[~2024-08-30 19:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-29 23:05 [PATCH] lei: increase umask timeout Eric Wong
2024-08-30 19:05 ` Eric Wong [this message]

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=20240830190515.M762314@dcvr \
    --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).