• Mikio Hara's avatar
    runtime, internal/poll, net: report event scanning error on read event · a5fdd58c
    Mikio Hara authored
    This change makes it possible the runtime-integrated network poller and
    APIs in the package internal/poll to report an event scanning error on a
    read event.
    
    The latest Go releases open up the way of the manipulation of the poller
    for users. On the other hand, it starts misleading users into believing
    that the poller accepts any user-configured file or socket perfectly
    because of not reporting any error on event scanning, as mentioned in
    issue 30426. The initial implementation of the poller was designed for
    just well-configured, validated sockets produced by the package net.
    However, the assumption is now obsolete.
    
    Fixes #30624.
    
    Benchmark results on linux/amd64:
    
    benchmark                              old ns/op     new ns/op     delta
    BenchmarkTCP4OneShot-4                 24649         23979         -2.72%
    BenchmarkTCP4OneShotTimeout-4          25742         24411         -5.17%
    BenchmarkTCP4Persistent-4              5139          5222          +1.62%
    BenchmarkTCP4PersistentTimeout-4       4919          4892          -0.55%
    BenchmarkTCP6OneShot-4                 21182         20767         -1.96%
    BenchmarkTCP6OneShotTimeout-4          23364         22305         -4.53%
    BenchmarkTCP6Persistent-4              4351          4366          +0.34%
    BenchmarkTCP6PersistentTimeout-4       4227          4255          +0.66%
    BenchmarkTCP4ConcurrentReadWrite-4     2309          1839          -20.36%
    BenchmarkTCP6ConcurrentReadWrite-4     2180          1791          -17.84%
    
    benchmark                              old allocs     new allocs   delta
    BenchmarkTCP4OneShot-4                 26             26           +0.00%
    BenchmarkTCP4OneShotTimeout-4          26             26           +0.00%
    BenchmarkTCP4Persistent-4              0              0            +0.00%
    BenchmarkTCP4PersistentTimeout-4       0              0            +0.00%
    BenchmarkTCP6OneShot-4                 26             26           +0.00%
    BenchmarkTCP6OneShotTimeout-4          26             26           +0.00%
    BenchmarkTCP6Persistent-4              0              0            +0.00%
    BenchmarkTCP6PersistentTimeout-4       0              0            +0.00%
    BenchmarkTCP4ConcurrentReadWrite-4     0              0            +0.00%
    BenchmarkTCP6ConcurrentReadWrite-4     0              0            +0.00%
    
    benchmark                              old bytes     new bytes     delta
    BenchmarkTCP4OneShot-4                 2000          2000          +0.00%
    BenchmarkTCP4OneShotTimeout-4          2000          2000          +0.00%
    BenchmarkTCP4Persistent-4              0             0             +0.00%
    BenchmarkTCP4PersistentTimeout-4       0             0             +0.00%
    BenchmarkTCP6OneShot-4                 2144          2144          +0.00%
    BenchmarkTCP6OneShotTimeout-4          2144          2145          +0.05%
    BenchmarkTCP6Persistent-4              0             0             +0.00%
    BenchmarkTCP6PersistentTimeout-4       0             0             +0.00%
    BenchmarkTCP4ConcurrentReadWrite-4     0             0             +0.00%
    BenchmarkTCP6ConcurrentReadWrite-4     0             0             +0.00%
    
    Change-Id: Iab60e504dff5639e688dc5420d852f336508c0af
    Reviewed-on: https://go-review.googlesource.com/c/go/+/166497
    Run-TryBot: Mikio Hara <mikioh.public.networking@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
    a5fdd58c
fd_poll_runtime.go 3.74 KB