On Wed, Aug 05, 2020 at 09:28:12PM +0300, Peter Pentchev wrote: > On Wed, Aug 05, 2020 at 08:01:53PM +0200, Michał Mirosław wrote: > > On Sun, Aug 02, 2020 at 05:34:40PM +0300, Peter Pentchev wrote: > > > On Sun, Aug 02, 2020 at 02:02:22AM +0200, Michał Mirosław wrote: > > [...] > > > --- a/debian/tests/runtime > > > +++ b/debian/tests/runtime > > > @@ -432,6 +432,7 @@ MAIN: > > > > > > if (!defined $line) { > > > $eof->send($got_version); > > > + undef $f_out; > > > } elsif (!$got_version) { > > > if ($line =~ m{^ > > > stunnel \s+ > > > > I believe $f_out will not be defined here, as it only gets set after > > sub{} is created. Perl confirms this: > > > > $ TEST_STUNNEL=src/stunnel strace -f -o /tmp/log debian/tests/runtime > > Global symbol "$f_out" requires explicit package name (did you forget to > > declare "my $f_out"?) at debian/tests/runtime line 435. > > Execution of debian/tests/runtime aborted due to compilation errors. > > Of course you're right. Sorry about that! That's what I get for writing > a patch three minutes before I have to head out and never remembering to > actually test it later :( > > How about the attached one? [...] > --- a/debian/tests/runtime > +++ b/debian/tests/runtime > @@ -424,7 +424,8 @@ MAIN: > > my ($got_version, $before_version) = (undef, ''); > my $eof = AnyEvent->condvar; > - my $f_out = AnyEvent->io( > + my $f_out; > + $f_out = AnyEvent->io( > fh => $s_in, > poll => 'r', > cb => sub { > @@ -432,6 +433,7 @@ MAIN: > > if (!defined $line) { > $eof->send($got_version); > + undef $f_out; > } elsif (!$got_version) { > if ($line =~ m{^ > stunnel \s+
This stops the endless readings of EOF, but: 1. the FD gets leaked (shouldn't matter much, though) 2. the test hangs anyway Using print-debugging, I see that it stops at wait_for_child line just after printing the version. It seems that something is reaping the child before the main thread has a chance to wait for it. >From strace: 4285 +++ exited with 0 +++ 4284 <... epoll_ctl resumed> ) = 0 4284 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=4285, si_uid=1000, si_status=0, si_utime=0, si_stime=0} --- 4284 write(4, "\1\0\0\0\0\0\0\0", 8) = 8 4284 rt_sigreturn({mask=[PIPE]}) = 0 4284 epoll_wait(3, [{EPOLLHUP, {u32=5, u64=4294967301}}, {EPOLLIN, {u32=4, u64=4294967300}}], 64, 59743) = 2 4284 epoll_ctl(3, EPOLL_CTL_MOD, 5, {EPOLLIN, {u32=5, u64=4294967301}}) = 0 4284 read(4, "\1\0\0\0\0\0\0\0", 8) = 8 4284 wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, NULL) = 4285 4284 wait4(-1, 0x7ffcd56d5784, WNOHANG|WSTOPPED|WCONTINUED, NULL) = -1 ECHILD (No child processes) 4284 wait4(-1, 0x7ffcd56d5534, WNOHANG, NULL) = -1 ECHILD (No child processes) This is before the 'wait_for_child' a few lines later. 4284 epoll_wait(3, [{EPOLLHUP, {u32=5, u64=4294967301}}], 64, 59743) = 1 4284 epoll_ctl(3, EPOLL_CTL_MOD, 5, {EPOLLIN, {u32=5, u64=4294967301}}) = 0 4284 read(5, "", 8192) = 0 4284 write(1, "Got stunnel version 5.56\n", 25) = 25 4284 write(2, "wait child 4285\n", 16) = 16 This is version printout plus my check. 4284 epoll_wait(3, [{EPOLLHUP, {u32=5, u64=4294967301}}], 64, 59743) = 1 4284 epoll_ctl(3, EPOLL_CTL_DEL, 5, 0x5631c0d44a40) = 0 This clears watcher for the pipe. 4284 epoll_wait(3, 0x5631c0d44a40, 64, 59743) = -1 EINTR (Interrupted system call) And this waits forever. Best Regards Michał Mirosław