| Age | Commit message (Collapse) | Author |
|
The runtime poller and os.NewFile recently gained support for
disassociating the handle from the runtime poller IOCP (see CL 664455).
This was the main blocker for allowing the conversion between *os.File
and net.Conn.
Implementing the conversion is now trivial. The only remaining work,
implemented in this CL, is improving os.NewFile to also support
socket handles and updating some build tags so that Windows can share
almost the same net's File implementation as Unix.
There is one important limitation, though: the duplicated socket handle
returned by the various File methods in the net package is not
usable on other process. If someone needs to pass a socket handle to
another process, they should manually call the WSADuplicateSocket
Windows API passing the process ID of the target process.
Fixes #9503.
Fixes #10350.
Updates #19098.
Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-race,gotip-windows-amd64-longtest,gotip-windows-arm64
Change-Id: Ic43cadaac2662b925d57a9d362ddc7ae21d1b56e
Reviewed-on: https://go-review.googlesource.com/c/go/+/668195
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
|
|
In test files, using testenv.Executable is more reliable than
os.Executable or os.Args[0].
Change-Id: I88e577efeabc20d02ada27bf706ae4523129128e
Reviewed-on: https://go-review.googlesource.com/c/go/+/651955
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
|
|
Fixes #62254
Fixes #48622
Change-Id: Ida598e7fa914c8737fdbc1c813bcd68adb5119c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/542275
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
|
|
Follow up CL 543276
Change-Id: Ie02cf8a489a069bb0a3be1d8636e30d0658329c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/562595
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
|
|
When I introduced the benchmark test code for sendfile(2) in CL 425878,
I only did it on Linux while the sendfile system call is also available
on other Unix-like and Windows platforms, this CL will pick up where I left out.
goos: darwin
goarch: arm64
pkg: net
BenchmarkSendFile/file-to-tcp/1024-10 2240488 749.5 ns/op 1366.30 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/2048-10 1956669 850.4 ns/op 2408.38 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/4096-10 840103 1593 ns/op 2571.30 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/8192-10 449536 2881 ns/op 2843.35 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/16384-10 269974 6307 ns/op 2597.86 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/32768-10 137210 12646 ns/op 2591.09 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/65536-10 66642 24557 ns/op 2668.74 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/131072-10 37852 59550 ns/op 2201.03 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/262144-10 16288 107859 ns/op 2430.44 MB/s 2 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/524288-10 10540 249957 ns/op 2097.52 MB/s 3 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/1048576-10 4982 419750 ns/op 2498.09 MB/s 6 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/1024-10 1180185 1187 ns/op 862.66 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/2048-10 523159 2294 ns/op 892.78 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/4096-10 238792 5223 ns/op 784.29 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/8192-10 116611 10929 ns/op 749.58 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/16384-10 57568 19870 ns/op 824.57 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/32768-10 32280 33696 ns/op 972.47 MB/s 1 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/65536-10 17242 72122 ns/op 908.69 MB/s 1 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/131072-10 8350 159131 ns/op 823.67 MB/s 3 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/262144-10 3872 318000 ns/op 824.35 MB/s 8 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/524288-10 1766 600785 ns/op 872.67 MB/s 18 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/1048576-10 993 1138624 ns/op 920.92 MB/s 33 B/op 0 allocs/op
goos: linux
goarch: amd64
pkg: net
cpu: DO-Premium-AMD
BenchmarkSendFile/file-to-tcp/1024-8 1796002 716.3 ns/op 1429.59 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/2048-8 1196700 896.6 ns/op 2284.23 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/4096-8 923604 2385 ns/op 1717.48 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/8192-8 638967 9722 ns/op 842.60 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/16384-8 357740 18710 ns/op 875.67 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/32768-8 147417 17489 ns/op 1873.66 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/65536-8 113054 58818 ns/op 1114.21 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/131072-8 57981 113202 ns/op 1157.86 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/262144-8 26362 253376 ns/op 1034.61 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/524288-8 13767 442053 ns/op 1186.03 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-tcp/1048576-8 4906 829984 ns/op 1263.37 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/1024-8 2031691 628.9 ns/op 1628.36 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/2048-8 1294472 965.0 ns/op 2122.30 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/4096-8 1005753 1203 ns/op 3404.27 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/8192-8 865448 6412 ns/op 1277.65 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/16384-8 268946 12801 ns/op 1279.89 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/32768-8 153398 6691 ns/op 4897.23 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/65536-8 88911 11969 ns/op 5475.36 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/131072-8 48639 107538 ns/op 1218.84 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/262144-8 22720 203199 ns/op 1290.09 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/524288-8 12034 97126 ns/op 5398.03 MB/s 0 B/op 0 allocs/op
BenchmarkSendFile/file-to-unix/1048576-8 5374 202308 ns/op 5183.06 MB/s 0 B/op 0 allocs/op
Change-Id: Ib9507bd9837ecb38b1702afa89502da18806929c
Reviewed-on: https://go-review.googlesource.com/c/go/+/543276
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
To get them to pass, implement more fake syscalls.
To make those syscalls easier to reason about, replace
the use of sync.Cond with selectable channels.
Fixes #59718.
Fixes #50216.
Change-Id: I135a6656f5c48f0e5c43dc4d4bcbdb48ee5535d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/526117
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Achille Roussel <achille.roussel@gmail.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
For #58141
Co-authored-by: Richard Musiol <neelance@gmail.com>
Co-authored-by: Achille Roussel <achille.roussel@gmail.com>
Co-authored-by: Julien Fabre <ju.pryz@gmail.com>
Co-authored-by: Evan Phoenix <evan@phx.io>
Change-Id: I09a7cf33e43cb0e17ab3793c22cbad90b9e83b62
Reviewed-on: https://go-review.googlesource.com/c/go/+/479626
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
|
|
Fixes #52798.
Fixes #51441 (until proven otherwise 😅).
Change-Id: Ic1eadebd0d41c5cbe37340190f8b2bde4b6c5673
Reviewed-on: https://go-review.googlesource.com/c/go/+/405214
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
|
|
This change applies the same transformation as in CL 366774,
but to the net package.
testUnixAddr was using os.CreateTemp to obtain a unique socket path,
but then calling os.Remove on that path immediately. Since the
existence of the file is what guarantees its uniqueness, that could
occasionally result in testUnixAddr returning the same path for two
calls, causing the tests using those paths to fail — especially if
they are the same test or are run in parallel.
Instead, we now create a unique, short temp directory for each call,
and use a path within that directory for the socket address.
For #34611
Change-Id: I8e13b606abce2479a0305f7aeecf5d54c449a032
Reviewed-on: https://go-review.googlesource.com/c/go/+/370694
Trust: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
|
|
Passing in an explicit testing.TB gives two benefits:
1. It allows the helper to fail the test itself, instead of returning
an error to the caller. A non-nil error invariably fails the
calling test, and none of these callers bother to add detail to the
error when logging it anyway so returning the error just added
noise to the test bodies.
2. It allows the helper to use t.Cleanup to perform any needed cleanup
tasks, which will be used in CL 370695 to clean up temp directories
used as namespaces for unix socket paths.
For #34611
Change-Id: I805e701687c12de2caca955649369294229c10b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/370696
Trust: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
|
|
These tests were checking for fairly narrow timing windows, but were
running in parallel and heavily dependent on timer and goroutine
scheduling. This change eliminates unnecessary goroutines, runs the
tests sequentially (dramatically shortening the timeouts to reduce the
penalty of doing so), and uses timestamp comparison instead of
background timers to hopefully gain some robustness from monotonic
timestamps.
Many of the other tests from this package would benefit from similar
simplifications, which we can apply if and when we notice flaky
failures or want to improve the latency of running the test.
Fixes #36108
Change-Id: I17d8af7d2eefb1ec14fe0d9d891142a39599a562
Reviewed-on: https://go-review.googlesource.com/c/go/+/365334
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
|
|
When these packages are released as part of Go 1.18,
Go 1.16 will no longer be supported, so we can remove
the +build tags in these files.
Ran go fix -fix=buildtag std cmd and then reverted the bootstrapDirs
as defined in src/cmd/dist/buildtool.go, which need to continue
to build with Go 1.4 for now.
Also reverted src/vendor and src/cmd/vendor, which will need
to be updated in their own repos first.
Manual changes in runtime/pprof/mprof_test.go to adjust line numbers.
For #41184.
Change-Id: Ic0f93f7091295b6abc76ed5cd6e6746e1280861e
Reviewed-on: https://go-review.googlesource.com/c/go/+/344955
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
|
|
Make all our package sources use Go 1.17 gofmt format
(adding //go:build lines).
Part of //go:build change (#41184).
See https://golang.org/design/draft-gobuild
Change-Id: Ia0534360e4957e58cd9a18429c39d0e32a6addb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/294430
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
|
|
The transponder sets up a deferred close on accepted connections which
is fine after the client reads all data. However there are no mutexes
nor channels to block the transponder from closing. If the scheduler
runs close before the client read, it will cause an EOF failure.
Fixes #42720
Change-Id: Ic21b476c5efc9265a80a2c6f8484efdb5af66405
Reviewed-on: https://go-review.googlesource.com/c/go/+/273672
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Damien Neil <dneil@google.com>
|
|
As part of #42026, these helpers from io/ioutil were moved to os.
(ioutil.TempFile and TempDir became os.CreateTemp and MkdirTemp.)
Update the Go tree to use the preferred names.
As usual, code compiled with the Go 1.4 bootstrap toolchain
and code vendored from other sources is excluded.
ReadDir changes are in a separate CL, because they are not a
simple search and replace.
For #42026.
Change-Id: If318df0216d57e95ea0c4093b89f65e5b0ababb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/266365
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
|
|
Updates https://gcc.gnu.org/PR89406
Change-Id: Iccf2760e42e9caa90720b96e74a805a9c0d48f35
Reviewed-on: https://go-review.googlesource.com/c/163277
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.public.networking@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
|
|
This commit adds the js/wasm architecture to the net package.
The net package is not supported by js/wasm, but a simple fake
networking is available so tests of other packages that require
basic TCP sockets can pass. The tests of the net package itself
are mostly disabled.
Updates #18892
Change-Id: Id287200c39f0a3e23d20ef17260ca15ccdcca032
Reviewed-on: https://go-review.googlesource.com/109995
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
|
|
This change delays IP protocol stack-snooping system calls until the
start of connection setup for the better experience with some system
call auditing, such as seccomp on Linux. See #16789 for examples.
Also updates the documentation on favoriteAddrFamily, which is the
owner of stack-snooping system calls.
Fixes #16789.
Change-Id: I4af27bc1ed06ffb1f657b6f6381c328c1f41c66c
Reviewed-on: https://go-review.googlesource.com/40750
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
|
|
Fixes #15316.
Fixes #15574.
Change-Id: I3ec8bffd35b9e5123de4be983a53fc0b8c2a0895
Reviewed-on: https://go-review.googlesource.com/23242
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
|
|
Fixes #15570
Change-Id: I95d1ac26e342c3bbf36ad1f0209711ea96eaf487
Reviewed-on: https://go-review.googlesource.com/22870
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
|
|
Change-Id: I41691134770d01805c19c0f84f8828b00b85de0c
Reviewed-on: https://go-review.googlesource.com/22058
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
|
|
This deletes unused code and helpers from tests.
Change-Id: Ie31d46115f558ceb8da6efbf90c3c204e03b0d7e
Reviewed-on: https://go-review.googlesource.com/20927
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
|
|
Change-Id: I8987e705af069846e6668e2f2104e0254e695139
Reviewed-on: https://go-review.googlesource.com/19706
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
|
|
This change ensures that the test does not try to close dual stack
listeners which have not yet been opened.
Spotted in crash here
http://build.golang.org/log/e5843777df400868ce708b7f00c50dc32c2ec478
Change-Id: I79d513e166effb3e018e2b9dfc23751d92fcbe4b
Reviewed-on: https://go-review.googlesource.com/10371
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
|
|
Also adds missing temporary file deletion.
Change-Id: Ia644b0898022e05d2f5232af38f51d55e40c6fb5
Reviewed-on: https://go-review.googlesource.com/9772
Reviewed-by: Ian Lance Taylor <iant@golang.org>
|
|
This change makes TestDualStack{TCP,UDP}Listener work more properly by
attempting to book an available service port before testing.
Also simplifies error messages in tests.
Fixes #5001.
Change-Id: If13b0d0039878c9bd32061a0440664e4fa7abaf7
Reviewed-on: https://go-review.googlesource.com/9661
Reviewed-by: Ian Lance Taylor <iant@golang.org>
|
|
This change deflakes timeout, deadline tests, especially fixes socket
and goroutine leaks. Also adds a few missing tests that use features
introduced after go1 release.
Change-Id: Ibf73a4859f8d4a0ee494ca2fd180cbce72a7a2c7
Reviewed-on: https://go-review.googlesource.com/9464
Reviewed-by: Ian Lance Taylor <iant@golang.org>
|
|
Also moves a few server test helpers into mockserver_test.go.
Change-Id: I5a95c9bc6f0c4683751bcca77e26a8586a377466
Reviewed-on: https://go-review.googlesource.com/9106
Reviewed-by: Ian Lance Taylor <iant@golang.org>
|
|
This change tries to stop various tester goroutines at the end of each
scope for avoiding interference between test cases including benchmarks.
Not yet finished completely but enough to land upcoming changes to Dial
functions. The rest will be fixed later.
Change-Id: Ic38b8681a3a2ddbcd69ba3696f24a61d418a0346
Reviewed-on: https://go-review.googlesource.com/8398
Reviewed-by: Ian Lance Taylor <iant@golang.org>
|
|
Preparation was in CL 134570043.
This CL contains only the effect of 'hg mv src/pkg/* src'.
For more about the move, see golang.org/s/go14nopkg.
|