develooper Front page | perl.perl5.porters | Postings from June 2019

[perl #134224] Bleadperl v5.31.0-169-gbc26d2e6b2 breaksDMUEY/IO-Socket-ByteCounter-v0.0.2.tar.gz

Thread Previous | Thread Next
From:
Tony Cook via RT
Date:
June 26, 2019 00:24
Subject:
[perl #134224] Bleadperl v5.31.0-169-gbc26d2e6b2 breaksDMUEY/IO-Socket-ByteCounter-v0.0.2.tar.gz
Message ID:
rt-4.0.24-21637-1561508643-110.134224-15-0@perl.org
On Tue, 25 Jun 2019 16:19:14 -0700, tonyc wrote:
> On Tue, Jun 25, 2019 at 01:24:47PM -0700, James E Keenan via RT wrote:
> > On Tue, 25 Jun 2019 17:48:46 GMT,
> > andreas.koenig.7os6VVqR@franz.ak.mind.de wrote:
> > > As per subject. No FAIL reports, tests just hang during
> > > t/IO-Socket-ByteCounter.t, since commit bc26d2e6b2.
> > >
> > > Seen on linux with plenty different configurations. If you cannot
> > > reproduce, please let me know with which details I can help you.
> >
> > IO::Socket::ByteCounter installs without incident against blead
> > (v5.31.1-106-g0be0ef8f51) on FreeBSD-11.
> >
> > However, I can confirm that there are indefinite hangs in the test
> > file on Linux.
> 
> Does it stop hanging if you remove 'mypeer' from
> 
> > $sock->recv($buf, 12);
> > $sock->send("Hello Yourself, Lovely weather today", 0, 'mypeer');
> 
> Here ^^
> 
> >
> > $sock->send("Hello World\n", 0, 'mypeer');
> 
> and here^^ ?

Turns out it does.

The main focus of the changes that ended up completed by bc26d2e6b2 was to ensure that if you supplied a TO parameter to IO::Socket send() it would be supplied to the underlying CORE::send() call, since this is supported at least for UDP sockets on Linux.

Which is the problem here, the test code calls send() on a connected UNIX socket with a TO parameter which causes the CORE::send() call to fail.

The parent or child expecting to recv() the message would then hang waiting for the unsent message.

Adding error checking to the method calls results in reasonable error messages:

t/IO-Socket-ByteCounter.t .. 1/5 Transport endpoint is already connected at t/IO-Socket-ByteCounter.t line 38.
Transport endpoint is already connected at t/IO-Socket-ByteCounter.t line 20.
# Looks like your test exited with 106 just after 2.
t/IO-Socket-ByteCounter.t .. Dubious, test returned 106 (wstat 27136, 0x6a00)
Failed 3/5 subtests 

Removing the extraneous 'peer' parameter allows the test to pass:

PERL_DL_NONLAZY=1 "/home/tonyc/perl/blead/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/IO-Socket-ByteCounter.t .. ok   
All tests successful.
Files=1, Tests=5,  1 wallclock secs ( 0.05 usr  0.01 sys +  0.22 cusr  0.02 csys =  0.30 CPU)
Result: PASS

I think the change to IO::Socket::send() is reasonable - the old behaviour of ignoring the parameter (which could make $socket->peername lie) was fairly broken.

One option might be to modify IO::Socket::send() to die on EISCONN when TO is supplied, but the caller should reaslly be checking for errors.

I've opened https://rt.cpan.org/Ticket/Display.html?id=129909

Tony

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=134224

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About