From 02cd38ea042e01f343d52f8401cd56cf8e37dd9d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 8 Oct 2023 22:11:48 +0000 Subject: introduce ProcessIONBF for multiplexed non-blocking IO This is required for reliable epoll/kevent/poll/select wakeup notifications, since we have no visibility into the buffer states used internally by Perl. We can safely use sysread here since we never use the :utf8 nor any :encoding Perl IO layers for readable pipes. I suspect this fixes occasional failures from t/solver_git.t when retrieving the WwwCoderepo summary. --- lib/PublicInbox/HTTPD/Async.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/HTTPD/Async.pm') diff --git a/lib/PublicInbox/HTTPD/Async.pm b/lib/PublicInbox/HTTPD/Async.pm index b9d2159c..b73d0c4b 100644 --- a/lib/PublicInbox/HTTPD/Async.pm +++ b/lib/PublicInbox/HTTPD/Async.pm @@ -18,6 +18,7 @@ use v5.12; use parent qw(PublicInbox::DS); use Errno qw(EAGAIN); use PublicInbox::Syscall qw(EPOLLIN); +use PublicInbox::ProcessIONBF; # This is called via: $env->{'pi-httpd.async'}->() # $io is a read-only pipe ($rpipe) for now, but may be a @@ -37,8 +38,7 @@ sub new { arg => $arg, # arg for $cb end_obj => $end_obj, # like END{}, can ->event_step }, $class; - my $pp = tied *$io; # ProcessIO - $pp->{fh}->blocking(0) // die "$io->blocking(0): $!"; + PublicInbox::ProcessIONBF->replace($io); $self->SUPER::new($io, EPOLLIN); } -- cgit v1.2.3-24-ge0c7