unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH 0/2] fix "make check-run" reliability
@ 2021-07-28  0:37 Eric Wong
  2021-07-28  0:37 ` [PATCH 1/2] lei: die on ECONNRESET Eric Wong
  2021-07-28  0:37 ` [PATCH 2/2] listener: maximize listen(2) backlog Eric Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Wong @ 2021-07-28  0:37 UTC (permalink / raw)
  To: meta

It took me way too long to figure this out :<

Eric Wong (2):
  lei: die on ECONNRESET
  listener: maximize listen(2) backlog

 lib/PublicInbox/LEI.pm      | 1 -
 lib/PublicInbox/Listener.pm | 2 +-
 script/lei                  | 1 -
 3 files changed, 1 insertion(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] lei: die on ECONNRESET
  2021-07-28  0:37 [PATCH 0/2] fix "make check-run" reliability Eric Wong
@ 2021-07-28  0:37 ` Eric Wong
  2021-07-28  0:37 ` [PATCH 2/2] listener: maximize listen(2) backlog Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2021-07-28  0:37 UTC (permalink / raw)
  To: meta

ECONNRESET should be rare on a private local socket, and if
we hit it, it's because we're hitting the listen() limit.
---
 script/lei | 1 -
 1 file changed, 1 deletion(-)

diff --git a/script/lei b/script/lei
index fce8124a..99d94b4e 100755
--- a/script/lei
+++ b/script/lei
@@ -115,7 +115,6 @@ while (1) {
 	my (@fds) = $recv_cmd->($sock, my $buf, 4096 * 33);
 	if (scalar(@fds) == 1 && !defined($fds[0])) {
 		next if $!{EINTR};
-		last if $!{ECONNRESET};
 		die "recvmsg: $!";
 	}
 	last if $buf eq '';

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] listener: maximize listen(2) backlog
  2021-07-28  0:37 [PATCH 0/2] fix "make check-run" reliability Eric Wong
  2021-07-28  0:37 ` [PATCH 1/2] lei: die on ECONNRESET Eric Wong
@ 2021-07-28  0:37 ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2021-07-28  0:37 UTC (permalink / raw)
  To: meta

This helps avoid errors from script/lei dying on ECONNRESET
when a single lei-daemon is serving all tests when run via
"make check-run".

Instead of using some arbitrary limit, use INT_MAX and let
the kernel clamp it (both Linux and FreeBSD do).

There's no need to call listen() in LEI.pm, either, since
Listener->new takes care of it.
---
 lib/PublicInbox/LEI.pm      | 1 -
 lib/PublicInbox/Listener.pm | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index 191a0790..38b268d3 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -1205,7 +1205,6 @@ sub lazy_start {
 	}
 	umask(077) // die("umask(077): $!");
 	bind($listener, $addr) or die "bind($path): $!";
-	listen($listener, 1024) or die "listen: $!";
 	$lk->lock_release;
 	undef $lk;
 	my @st = stat($path) or die "stat($path): $!";
diff --git a/lib/PublicInbox/Listener.pm b/lib/PublicInbox/Listener.pm
index c8315810..64bba5b0 100644
--- a/lib/PublicInbox/Listener.pm
+++ b/lib/PublicInbox/Listener.pm
@@ -20,7 +20,7 @@ sub new ($$$) {
 	my ($class, $s, $cb) = @_;
 	setsockopt($s, SOL_SOCKET, SO_KEEPALIVE, 1);
 	setsockopt($s, IPPROTO_TCP, TCP_NODELAY, 1); # ignore errors on non-TCP
-	listen($s, 1024);
+	listen($s, 2**31 - 1); # kernel will clamp
 	my $self = bless { post_accept => $cb }, $class;
 	$self->SUPER::new($s, EPOLLIN|EPOLLET|EPOLLEXCLUSIVE);
 }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-28  0:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-28  0:37 [PATCH 0/2] fix "make check-run" reliability Eric Wong
2021-07-28  0:37 ` [PATCH 1/2] lei: die on ECONNRESET Eric Wong
2021-07-28  0:37 ` [PATCH 2/2] listener: maximize listen(2) backlog 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).