go/src
Bryan C. Mills ada95e2807 net: in TestNotTemporaryRead, do not assume that a dialed connection has been accepted
Previously, TestNotTemporaryRead issued the Read on the Accept side of
the connection, and Closed the Dial side. It appears that on some
platforms, Dial may return before the connection has been Accepted,
and if that connection is immediately closed with no bytes written and
SO_LINGER set to 0, the connection may no longer even exist by the
time Accept returns, causing Accept to block indefinitely until the
Listener is closed.

If we were to just swap the directions, we would have an analogous
problem: Accept could accept the connection and close it before the
client even finishes dialing, causing Dial (instead of Read) to return
the ECONNRESET error.

Here, we take a middle path: we Accept and Dial the connection
concurrently, but wait until both the Accept and the Dial have
returned (indicating that the connection is completely established and
won't vanish from the accept queue) before resetting the connection.

Fixes #29685
Updates #25289

Change-Id: Ida06f70f7205fffcdafa3df78bd56184e6cec760
Reviewed-on: https://go-review.googlesource.com/c/go/+/385314
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-14 21:55:10 +00:00
..
archive all: add a handful of fuzz targets 2022-01-13 18:06:33 +00:00
bufio
builtin builtin: clarify that interface types do not implement comparable 2022-02-08 21:59:36 +00:00
bytes bytes, strings: mention Cut in docs for Split and SplitN 2022-02-08 22:25:54 +00:00
cmd cmd/go: enable file shortening for lines starting with \t 2022-02-14 21:48:30 +00:00
compress all: add a handful of fuzz targets 2022-01-13 18:06:33 +00:00
container
context
crypto crypto/aes: fix key size typo 2022-02-09 21:39:49 +00:00
database/sql database/sql: consolidate test polling loops 2022-01-13 20:43:56 +00:00
debug runtime/debug: replace (*BuildInfo).Marshal methods with Parse and String 2022-02-09 19:44:03 +00:00
embed
encoding all: add a handful of fuzz targets 2022-01-13 18:06:33 +00:00
errors
expvar
flag
fmt
go go/types, types2: no need to revert tparam renaming in inference results 2022-02-14 12:26:56 +00:00
hash
html
image all: add a handful of fuzz targets 2022-01-13 18:06:33 +00:00
index/suffixarray
internal internal/fuzz: change meaning of "total" in output 2022-02-04 22:34:05 +00:00
io
log
math math/big: prevent overflow in (*Rat).SetString 2022-01-27 21:25:18 +00:00
mime
net net: in TestNotTemporaryRead, do not assume that a dialed connection has been accepted 2022-02-14 21:55:10 +00:00
os os: add examples for Mkdir and MkdirAll 2022-02-08 23:38:05 +00:00
path
plugin
reflect
regexp regexp/syntax: reject very deeply nested regexps in Parse 2022-02-10 15:23:05 +00:00
runtime cmd/compile, runtime: use unwrapped PC for goroutine creation tracing 2022-02-11 20:01:24 +00:00
sort
strconv
strings bytes, strings: mention Cut in docs for Split and SplitN 2022-02-08 22:25:54 +00:00
sync
syscall syscall: use RLIMIT_CPU instead of RLIMIT_NOFILE 2022-02-09 22:06:20 +00:00
testdata
testing testing: remove TODO and link to fuzz docs 2022-02-04 22:27:25 +00:00
text
time
unicode
unsafe
vendor
Make.dist
README.vendor
all.bash
all.bat
all.rc
bootstrap.bash
buildall.bash
clean.bash
clean.bat
clean.rc
cmp.bash
go.mod
go.sum
make.bash
make.bat
make.rc
race.bash
race.bat
run.bash
run.bat
run.rc

README.vendor

Vendoring in std and cmd
========================

The Go command maintains copies of external packages needed by the
standard library in the src/vendor and src/cmd/vendor directories.

In GOPATH mode, imports of vendored packages are resolved to these
directories following normal vendor directory logic
(see golang.org/s/go15vendor).

In module mode, std and cmd are modules (defined in src/go.mod and
src/cmd/go.mod). When a package outside std or cmd is imported
by a package inside std or cmd, the import path is interpreted
as if it had a "vendor/" prefix. For example, within "crypto/tls",
an import of "golang.org/x/crypto/cryptobyte" resolves to
"vendor/golang.org/x/crypto/cryptobyte". When a package with the
same path is imported from a package outside std or cmd, it will
be resolved normally. Consequently, a binary may be built with two
copies of a package at different versions if the package is
imported normally and vendored by the standard library.

Vendored packages are internally renamed with a "vendor/" prefix
to preserve the invariant that all packages have distinct paths.
This is necessary to avoid compiler and linker conflicts. Adding
a "vendor/" prefix also maintains the invariant that standard
library packages begin with a dotless path element.

The module requirements of std and cmd do not influence version
selection in other modules. They are only considered when running
module commands like 'go get' and 'go mod vendor' from a directory
in GOROOT/src.

Maintaining vendor directories
==============================

Before updating vendor directories, ensure that module mode is enabled.
Make sure GO111MODULE=off is not set ('on' or 'auto' should work).

Requirements may be added, updated, and removed with 'go get'.
The vendor directory may be updated with 'go mod vendor'.
A typical sequence might be:

    cd src
    go get -d golang.org/x/net@latest
    go mod tidy
    go mod vendor

Use caution when passing '-u' to 'go get'. The '-u' flag updates
modules providing all transitively imported packages, not only
the module providing the target package.

Note that 'go mod vendor' only copies packages that are transitively
imported by packages in the current module. If a new package is needed,
it should be imported before running 'go mod vendor'.