* [PATCH 0/2] fix kqueue support and missed signal wakeups
@ 2019-11-27 1:33 7% ` Eric Wong
2019-11-27 1:33 6% ` [PATCH 1/2] dskqxs: fix missing EV_DISPATCH define Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2019-11-27 1:33 UTC (permalink / raw)
To: meta
signalfd and EVFILT_SIGNAL are pretty nice, actually. I'm
actually glad Perl5 allows users to call sigprocmask and use
these new APIs effectively, compared to other runtimes which
purport to know better :P
Note: the likelyhood of coalesced signals increases in high
load situations, but I don't think it matters in practice;
since we already account for coalescing in handling SIGCHLD.
Eric Wong (2):
dskqxs: fix missing EV_DISPATCH define
httpd|nntpd: avoid missed signal wakeups
MANIFEST | 3 +
lib/PublicInbox/DS.pm | 6 +-
lib/PublicInbox/DSKQXS.pm | 105 +++++++++++++++++----
lib/PublicInbox/Daemon.pm | 183 ++++++++++++++++++-------------------
lib/PublicInbox/Sigfd.pm | 63 +++++++++++++
lib/PublicInbox/Syscall.pm | 42 ++++++++-
t/ds-kqxs.t | 42 +++++++++
t/ds-poll.t | 16 +---
t/sigfd.t | 65 +++++++++++++
9 files changed, 397 insertions(+), 128 deletions(-)
create mode 100644 lib/PublicInbox/Sigfd.pm
create mode 100644 t/ds-kqxs.t
create mode 100644 t/sigfd.t
^ permalink raw reply [relevance 7%]
* [PATCH 1/2] dskqxs: fix missing EV_DISPATCH define
2019-11-27 1:33 7% ` [PATCH 0/2] fix kqueue support and missed signal wakeups Eric Wong
@ 2019-11-27 1:33 6% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2019-11-27 1:33 UTC (permalink / raw)
To: meta
Oops, IO::KQueue support was broken due to this missing
constant. Add a new ds-kqxs.t test case to ensure we
test the IO::KQueue path if IO::KQueue is available.
---
MANIFEST | 1 +
lib/PublicInbox/DSKQXS.pm | 2 ++
t/ds-kqxs.t | 14 ++++++++++++++
t/ds-poll.t | 16 ++++------------
4 files changed, 21 insertions(+), 12 deletions(-)
create mode 100644 t/ds-kqxs.t
diff --git a/MANIFEST b/MANIFEST
index 9fd639f5..a50c1246 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -207,6 +207,7 @@ t/config_limiter.t
t/content_id.t
t/convert-compact.t
t/data/0001.patch
+t/ds-kqxs.t
t/ds-leak.t
t/ds-poll.t
t/edit.t
diff --git a/lib/PublicInbox/DSKQXS.pm b/lib/PublicInbox/DSKQXS.pm
index 1c3b970b..84e146f8 100644
--- a/lib/PublicInbox/DSKQXS.pm
+++ b/lib/PublicInbox/DSKQXS.pm
@@ -21,6 +21,8 @@ use PublicInbox::Syscall qw(EPOLLONESHOT EPOLLIN EPOLLOUT EPOLLET
our @EXPORT_OK = qw(epoll_ctl epoll_wait);
my $owner_pid = -1; # kqueue is close-on-fork (yes, fork, not exec)
+sub EV_DISPATCH () { 0x0080 }
+
# map EPOLL* bits to kqueue EV_* flags for EV_SET
sub kq_flag ($$) {
my ($bit, $ev) = @_;
diff --git a/t/ds-kqxs.t b/t/ds-kqxs.t
new file mode 100644
index 00000000..785570c3
--- /dev/null
+++ b/t/ds-kqxs.t
@@ -0,0 +1,14 @@
+# Copyright (C) 2019 all contributors <meta@public-inbox.org>
+# Licensed the same as Danga::Socket (and Perl5)
+# License: GPL-1.0+ or Artistic-1.0-Perl
+# <https://www.gnu.org/licenses/gpl-1.0.txt>
+# <https://dev.perl.org/licenses/artistic.html>
+use strict;
+use Test::More;
+unless (eval { require IO::KQueue }) {
+ my $m = $^O !~ /bsd/ ? 'DSKQXS is only for *BSD systems'
+ : "no IO::KQueue, skipping $0: $@";
+ plan skip_all => $m;
+}
+local $ENV{TEST_IOPOLLER} = 'PublicInbox::DSKQXS';
+require './t/ds-poll.t';
diff --git a/t/ds-poll.t b/t/ds-poll.t
index c9dcdd22..21f8b295 100644
--- a/t/ds-poll.t
+++ b/t/ds-poll.t
@@ -7,7 +7,7 @@ use strict;
use warnings;
use Test::More;
use PublicInbox::Syscall qw(:epoll);
-my $cls = 'PublicInbox::DSPoll';
+my $cls = $ENV{TEST_IOPOLLER} // 'PublicInbox::DSPoll';
use_ok $cls;
my $p = $cls->new;
@@ -43,16 +43,8 @@ my @fds = sort(map { $_->[0] } @$events);
my @exp = sort((fileno($r), fileno($x)));
is_deeply(\@fds, \@exp, 'got both ready FDs');
-# EPOLL_CTL_DEL doesn't matter for kqueue, we do it in native epoll
-# to avoid a kernel-wide lock; but its not needed for native kqueue
-# paths so DSKQXS makes it a noop (as did Danga::Socket::close).
-SKIP: {
- if ($cls ne 'PublicInbox::DSPoll') {
- skip "$cls doesn't handle EPOLL_CTL_DEL", 2;
- }
- is($p->epoll_ctl(EPOLL_CTL_DEL, fileno($r), 0), 0, 'EPOLL_CTL_DEL OK');
- $n = $p->epoll_wait(9, 0, $events);
- is($n, 0, 'nothing ready after EPOLL_CTL_DEL');
-};
+is($p->epoll_ctl(EPOLL_CTL_DEL, fileno($r), 0), 0, 'EPOLL_CTL_DEL OK');
+$n = $p->epoll_wait(9, 0, $events);
+is($n, 0, 'nothing ready after EPOLL_CTL_DEL');
done_testing;
^ permalink raw reply related [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-11-25 8:59 [PATCH 10/17] daemon: avoid race when quitting workers Eric Wong
2019-11-27 1:33 7% ` [PATCH 0/2] fix kqueue support and missed signal wakeups Eric Wong
2019-11-27 1:33 6% ` [PATCH 1/2] dskqxs: fix missing EV_DISPATCH define 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).