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

Re: [perl #134446] Only cache io_socket_proto if protocol is truthy

Thread Next
From:
Andrew Hewus Fresh
Date:
September 23, 2019 15:57
Subject:
Re: [perl #134446] Only cache io_socket_proto if protocol is truthy
Message ID:
20190923155705.GO71289@us.holligan.net
On Mon, Sep 23, 2019 at 04:53:57AM -0700, James E Keenan via RT wrote:
> On Mon, 23 Sep 2019 11:45:26 GMT, jkeenan wrote:
> > On Mon, 23 Sep 2019 01:58:25 GMT, jkeenan wrote:
> > > On Mon, 23 Sep 2019 01:03:12 GMT, afresh1@openbsd.org wrote:
> > > > This may cause $sock->protocol to be undef on some systems
> > > > that don't support SO_PROTOCOL where it was 0 before, but that is
> > > > arguably more correct.
> > > >
<SNIP>
> > With the patch the branch is experiencing failures in
> > dist/IO/t/cachepropagate-unix.t on all our NetBSD smoke-testing rigs.
> > It's experiencing other failures on one of them (http://perl5.test-
> > smoke.org/report/95354 but ignore the failures in syslog.t).
> > 
> > Thank you very much.
> 
> In the preceding smoke-test report, most of the failures may be
> resource constraints.  However, here's what I got for the test in
> question:

This is kinda what I expected, not sure what the correct solution is.
Not sure why it's OK for `$sock->protocol` to return undef when you use
`new_from_fd` or after `accept` but not when you use `new`.  

It would be easy to add in some `skip` calls if `$listener->protocol`
returned undef in the test, and since I would expect calling
`->protocol` to be a shortcut to `getsockopt`, that's the semantics I
would expect to have, but is that what is wanted?  If so, the whole
cache line in `->socket` should be removed, which of course might cause
*other* problems if you expect `->protocol` to tell you what was
requested and not the value from `getsockopt`.

I'm not sure how to handle the fact that `->protocol` can return either
the requested protocol *or* the `getsockopt(..., SO_PROTOCOL)` with no
way to tell the difference.


> #####
> [perl-reporter-08] $ cd t;./perl harness -v ../dist/IO/t/cachepropagate-unix.t; cd -
> 
> ok 1 - stream socket created
> not ok 2 - protocol defined
> 
> #   Failed test 'protocol defined'
> #   at t/cachepropagate-unix.t line 43.
> ok 3 - domain defined
> ok 4 - type defined
> ok 5 - spawned a child
> ok 6 - domain match
> ok 7 # skip no Socket::SO_PROTOCOL
> ok 8 - type match
> ok 9 - datagram socket created
> not ok 10 - protocol defined
> 
> #   Failed test 'protocol defined'
> #   at t/cachepropagate-unix.t line 93.
> ok 11 - domain defined
> ok 12 - type defined
> ok 13 - domain match
> ok 14 # skip no Socket::SO_PROTOCOL
> ok 15 - type match
> # Looks like you failed 2 tests of 15.
> Dubious, test returned 2 (wstat 512, 0x200)
> Failed 2/15 subtests 
>         (less 2 skipped subtests: 11 okay)
> 
> Test Summary Report
> -------------------
> ../dist/IO/t/cachepropagate-unix.t (Wstat: 512 Tests: 15 Failed: 2)
>   Failed tests:  2, 10
>   Non-zero exit status: 2
> Files=1, Tests=15,  1 wallclock secs ( 0.03 usr  0.01 sys +  0.18 cusr  0.04 csys =  0.26 CPU)
> Result: FAIL
> #####
> 
> -- 
> James E Keenan (jkeenan@cpan.org)

-- 
andrew - http://afresh1.com

Speed matters.  
Almost as much as some things, and nowhere near as much as others.
                      -- Nick Holland

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