* [PATCH] lei: increase umask timeout
@ 2024-08-29 23:05 Eric Wong
2024-08-30 19:05 ` [PATCH v2] " Eric Wong
0 siblings, 1 reply; 2+ messages in thread
From: Eric Wong @ 2024-08-29 23:05 UTC (permalink / raw)
To: meta
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..6c0c8ce2 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 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 or die 'timeout waiting for umask';
} while ($r < 0 && $! == EINTR);
do {
$r = recv $s, $v, 5, 0;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH v2] lei: increase umask timeout
2024-08-29 23:05 [PATCH] lei: increase umask timeout Eric Wong
@ 2024-08-30 19:05 ` Eric Wong
0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2024-08-30 19:05 UTC (permalink / raw)
To: meta
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;
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-30 19:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-29 23:05 [PATCH] lei: increase umask timeout Eric Wong
2024-08-30 19:05 ` [PATCH v2] " Eric Wong
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).