runtime: make it harder to find collisions in the 64-bit fallback hash
Currently the first argument to mix() can be set by an attacker, as it
is just the input bytes xored by some constants. That lets an attacker
set the value being multipled by to 0. That can lead to lots of
collisions. To fix, xor the first argument with the process-wide seed,
so the magic collision-generating value isn't a constant known to the
attacker. (Maybe there's a timing attack that could figure out the
process-wide seed, but that's a much harder attack.)
Fixes #66841
Change-Id: I33e073c78355d1cee08660de52074e6ccc38b426
Reviewed-on: https://go-review.googlesource.com/c/go/+/579115 Reviewed-by: M Zhuo <mengzhuo1203@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Michael Anthony Knyszek [Thu, 18 Apr 2024 20:54:55 +0000 (20:54 +0000)]
runtime: track frame pointer while in syscall
Currently the runtime only tracks the PC and SP upon entering a syscall,
but not the FP (BP). This is mainly for historical reasons, and because
the tracer (which uses the frame pointer unwinder) does not need it.
Until it did, of course, in CL 567076, where the tracer tries to take a
stack trace of a goroutine that's in a syscall from afar. It tries to
use gp.sched.bp and lots of things go wrong. It *really* should be using
the equivalent of gp.syscallbp, which doesn't exist before this CL.
This change introduces gp.syscallbp and tracks it. It also introduces
getcallerfp which is nice for simplifying some code. Because we now have
gp.syscallbp, we can also delete the frame skip count computation in
traceLocker.GoSysCall, because it's now the same regardless of whether
frame pointer unwinding is used.
Fixes #66889.
Change-Id: Ib6d761c9566055e0a037134138cb0f81be73ecf7
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-nocgo
Reviewed-on: https://go-review.googlesource.com/c/go/+/580255
Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Michael Anthony Knyszek [Thu, 18 Apr 2024 17:38:30 +0000 (17:38 +0000)]
cmd/trace/v2: tolerate traces with broken tails
This change modifies cmd/trace/v2 to tolerate traces with
incomplete/broken generations at the tail. These broken tails can be
created if a program crashes while a trace is being produced. Although
the runtime tries to flush the trace on some panics, it may still
produce some extra trace data that is incomplete.
This change modifies cmd/trace/v2 to still work on any complete
generations, even if there are incomplete/broken generations at the tail
end of the trace. Basically, the tool now just tracks when the last good
generation ended (via Sync events) and truncates the trace to that point
when it encounters an error.
This change also revamps the text output of the tool to emit regular
progress notifications as well as warnings as to how much of the trace
data was lost.
Fixes #65316.
Change-Id: I877d39993bc02a81eebe647db9c2be17635bcec8
Reviewed-on: https://go-review.googlesource.com/c/go/+/580135 Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Michael Anthony Knyszek [Fri, 19 Apr 2024 04:41:01 +0000 (04:41 +0000)]
internal/concurrent: handle boundary case for hash bits in HashTrieMap
Currently the HashTrieMap has a panic for running out of hash bits, but
it turns out we can end up in these paths in valid cases, like inserting
or deleting an element that requires *all* the hash bits to finds its
position in the tree. There's basically an off-by-one error here where
the panic fires erroneously.
This wasn't caught before the original CL landed because it's very
unlikely on 64-bit platforms, with a 64-bit hash, but much more likely
on 32-bit platforms, where using all 32 bits of a 32-bit hash is much
more likely.
This CL makes the condition for panicking much more explicit, which
avoids the off-by-one error.
After this CL, I can't get the tests to fail on 32-bit under stress
testing.
Change-Id: I855e301e3b3893e2b6b017f6dd9f3d83a94a558d
Reviewed-on: https://go-review.googlesource.com/c/go/+/580138
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: David Chase <drchase@google.com>
Ian Lance Taylor [Sun, 3 Mar 2024 03:27:21 +0000 (19:27 -0800)]
reflect: omit anonymous field name from StructOf type string
This makes the reflect package match the compiler for StructOf
with an embedded field.
Fixes #24781
Change-Id: Ice64b167cbe0b9d30a953c5d8e2a86f3ad1158bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/567897
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org>
Commit-Queue: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Roland Shoemaker [Thu, 18 Apr 2024 17:51:25 +0000 (10:51 -0700)]
crypto/tls: don't cache marshal'd bytes
Only cache the wire representation for clientHelloMsg and serverHelloMsg
during unmarshal, which are the only places we actually need to hold
onto them. For everything else, remove the raw field.
Michael Pratt [Thu, 18 Apr 2024 16:42:43 +0000 (12:42 -0400)]
runtime: use bootstrapRand to initialize hashkey
The seed for rand is not initialized until after alginit. Before
initialization, rand returns a deterministic sequence, making hashkey
deterministic across processes.
Switch to bootstrapRand, like other early rand calls, such as
initialization of aeskeysched.
Fixes #66885.
Change-Id: I5023a9161232b49fda2ebd1d5f9338bbdd17b1fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/580136
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
The results of cmpstring are reuseable if the second call has the
same arguments and memory.
Note that this gets rid of cmpstring, but we still generate a
redundant </<= test and branch afterwards, because the compiler
doesn't know that cmpstring only ever returns -1,0,1.
Update #61725
Change-Id: I93a0d1ccca50d90b1e1a888240ffb75a3b10b59b
Reviewed-on: https://go-review.googlesource.com/c/go/+/578835 Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Jacob [Thu, 18 Apr 2024 16:24:24 +0000 (16:24 +0000)]
syscall/js: allocate arg slices on stack for small numbers of args
The existing implementation causes unnecessary heap allocations for
javascript syscalls: Call, Invoke, and New. The new change seeks to
hint the Go compiler to allocate arg slices with length <=16 to the
stack.
Original Work: CL 367045
- Calling a JavaScript function with 16 arguments or fewer will not
induce two additional heap allocations, at least with the current Go
compiler.
- Using syscall/js features with slices and strings of
statically-known length will not cause them to be escaped to the heap,
at least with the current Go compiler.
- The reduction in allocations has the additional benefit that the
garbage collector runs less often, blocking WebAssembly's one and only
thread less often.
Fixes #39740
Change-Id: I815047e1d4f8ada796318e2064d38d3e63f73098
GitHub-Last-Rev: 36df1b33a4506e216767d8a73395f2fafdd80eba
GitHub-Pull-Request: golang/go#66684
Reviewed-on: https://go-review.googlesource.com/c/go/+/576575 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Jes Cok [Fri, 19 Apr 2024 12:40:30 +0000 (20:40 +0800)]
doc: make symbol links simpler for relnotes
This is a follow-up to CL 578195.
Change-Id: I6466ff8753f05a9424a8098cd88490aab6b236c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/580277 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
The current implementation of the http package strips double quotes
from the cookie-value during parsing, resulting in the serialized
cookie not including them. This patch addresses this limitation by
introducing a new field to track whether the original value was
enclosed in quotes.
Additionally, the internal representation of a cookie in the cookiejar
package has been adjusted to align with the new representation.
The syntax of cookies is outlined in RFC 6265 Section 4.1.1:
https://datatracker.ietf.org/doc/html/rfc6265\#section-4.1.1
Fixes #46443
Change-Id: Iac12a56397d77a6060a75757ab0daeacc60457f3
GitHub-Last-Rev: a76440e741440cddaa05944b6828a14a32b5a44a
GitHub-Pull-Request: golang/go#66752
Reviewed-on: https://go-review.googlesource.com/c/go/+/577755 Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Alan Donovan [Tue, 20 Feb 2024 15:24:21 +0000 (10:24 -0500)]
go/types: add Func.Signature method
Unfortunately we can't enforce the repr invariant
that Func.typ != nil without thinking about the
object color invariants. For now, return a trivial
Signature if typ == nil, which should never happen
in bug-free client code.
Fixes golang/go#65772
Change-Id: I7f89c6d8fdc8dcd4b8880572e54bb0ed9b6136eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/565375
Commit-Queue: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This change adds the internal/weak package, which exposes GC-supported
weak pointers to the standard library. This is for the upcoming weak
package, but may be useful for other future constructs.
For #62483.
Change-Id: I4aa8fa9400110ad5ea022a43c094051699ccab9d
Reviewed-on: https://go-review.googlesource.com/c/go/+/576297
Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Michael Anthony Knyszek [Sat, 23 Mar 2024 01:21:03 +0000 (01:21 +0000)]
internal/concurrent: add HashTrieMap
This change adds a concurrent hash-trie map implementation to the
standard library in the new internal/concurrent package, intended to
hold concurrent data structures. (The name comes from how Java names
their concurrent data structure library in the standard library.)
This data structure is created specially for the upcoming unique
package. It is built specifically around frequent successful lookups and
comparatively rare insertions and deletions.
A valid question is whether this is worth it over a simple locked map.
Some microbenchmarks in this new package show that yes, this extra
complexity appears to be worth it.
Single-threaded performance for LoadOrStore is comparable to a locked
map for a map with 128k small string elements. The map scales perfectly
up to 24 cores for Loads, which is the maximum available parallelism
on my machine. LoadOrStore operations scale less well. Small maps will
have a high degree of contention, but for the unique library, small maps
are very unlikely to stay small if there are a lot of inserts, since
they have a full GC cycle to grow.
For #62483.
Change-Id: I38e5ac958d19ebdd0c8c02e36720bb3338fe2e35
Reviewed-on: https://go-review.googlesource.com/c/go/+/573956 Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Michael Pratt [Thu, 18 Apr 2024 17:52:44 +0000 (13:52 -0400)]
cmd/go: only attempt to match subset of $GOCACHE in test
This test attempted to be clever by looking for the entirety of $GOCACHE
in the compile command line to ensure that the profile was coming from
cache.
Unfortunately, on Windows $GOCACHE contains \, which needs extra
escaping in a regexp. As an approximate alternative, just look for the
"gocache" component specified when defining GOCACHE.
This fixes the Windows longtest builders.
Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest
Change-Id: If6c77cf066d8612431e0720405254e1fdf528e9b
Reviewed-on: https://go-review.googlesource.com/c/go/+/580137 Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: Michael Pratt <mpratt@google.com>
Robert Griesemer [Thu, 18 Apr 2024 15:51:27 +0000 (08:51 -0700)]
go/types, types2: use correct predicate when asserting comma-ok types
While at it and unrelated, up-date testdata/manual.go sample file so
we can just copy its contents into a test file after debugging, without
fixing the date.
Fixes #66878.
Change-Id: Ie49a341b78d99bdc0f1a0ba1ca42fa2d3a807bd6
Reviewed-on: https://go-review.googlesource.com/c/go/+/580075
Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Jes Cok [Wed, 17 Apr 2024 13:02:31 +0000 (21:02 +0800)]
doc: simplify symbol links for relnotes
This is a follow-up to CL 578195.
Change-Id: Iab38ee008df8b06c300b0027019cc0464bdadca1
Reviewed-on: https://go-review.googlesource.com/c/go/+/579796
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Jes Cok [Wed, 17 Apr 2024 18:29:55 +0000 (02:29 +0800)]
net/http: add case for TestParseSetCookie
Updates #66008
Change-Id: Idd36a7f0b4128adfd0a3d7fe76eb6c2cea4306a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/579795 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Than McIntosh [Mon, 8 Apr 2024 17:16:37 +0000 (17:16 +0000)]
cmd/compile/internal: stack slot merging region formation enhancements
This patch revises the algorithm/strategy used for overlapping the
stack slots of disjointly accessed local variables. The main change
here is to allow merging the stack slot of B into the slot for A if
B's size is less then A (prior to this they had to be identical), and
to also allow merging a non-pointer variables into pointer-variable
slots.
The new algorithm sorts the candidate list first by pointerness
(pointer variables first), then by alignment, then by size, and
finally by name. We no longer check that two variables have the same
GC shape before merging: since it should never be the case that we
have two vars X and Y both live across a given callsite where X and Y
share a stack slot, their gc shape doesn't matter.
Doing things this new way increases the total number of bytes saved
(across all functions) from 91256 to 124336 for the sweet benchmarks.
Updates #62737.
Updates #65532.
Updates #65495.
Change-Id: I1daaac1b1240aa47a6975e98ccd24e03304ab602
Reviewed-on: https://go-review.googlesource.com/c/go/+/577615
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Michael Pratt [Wed, 27 Mar 2024 16:09:26 +0000 (12:09 -0400)]
cmd/dist: allow arbitrary package renames for bootstrap imports
Import declaration matching currently has a list of specific cases. It
allows bare imports, dot imports, and renamed imports named "exec" and
"rtabi".
Keeping a specific allowlist of renamed imports is unnecessary and
causes annoyance for developers adding such imports, as the bootstrap
build errors do not make it clear that this is where the issue lies.
We can simplify this to be much more general. The body of the condition
will still only rewrite imports in cmd/ or in bootstrapDirs.
I believe the only downside of this change is that it makes it a bit
more likely to match and replace within comments. That said, there
should be no harm in replacements within comments.
This change results in no change to the resulting bootstrap source tree:
Michael Pratt [Thu, 29 Feb 2024 21:23:03 +0000 (16:23 -0500)]
cmd/go: use cache for PGO preprocessing
This is the final CL in the series adding PGO preprocessing support to
cmd/go. Now that the tool is hooked up, we integrate with the build
cache to cache the result.
This is fairly straightforward. One difference is that the compile and
link do caching through updateBuildID. However, preprocessed PGO files
don't have a build ID, so it doesn't make much sense to hack our way
through that function when it is simple to just add to the cache
ourselves.
As as aside, we could add a build ID to the preproccessed file format,
though it is not clear if it is worthwhile. The one place a build ID
could be used is in buildActionID, which currently compute the file hash
of the preprocessed profile. With a build ID it could simply read the
build ID. This would save one complete read of the file per build
(cmd/go caches the hash), but each compile process also reads the entire
file, so this is a small change overall.
Fixes #58102.
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Change-Id: I86e2999a08ccd264230fbb1c983192259b7288e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/569425
Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Michael Pratt [Wed, 28 Feb 2024 20:25:40 +0000 (15:25 -0500)]
cmd/go: inital plumbing for PGO profiles preprocessing
The new go tool preprofile preprocesses a PGO pprof profile into an
intermediate representation that is more efficient for the compiler to
consume. Performing preprocessing avoids having every single compile
process from duplicating the same processing.
This CL prepares the initial plumbing to support automatic preprocessing
by cmd/go.
Each compile action takes a new dependency on a new "preprocess PGO
profile" action. The same action instance is shared by all compile
actions (assuming they have the same input profile), so the action only
executes once.
Builder.build retrieves the file to pass to -pgofile from the output of
the preprocessing action, rather than directly from
p.Internal.PGOProfile.
Builder.buildActionID also uses the preprocess output as the PGO
component of the cache key, rather than the original source. This
doesn't matter for normal toolchain releases, as the two files are
semantically equivalent, but it is useful for correct cache invalidation
in development. For example, if _only_ go tool preprofile changes
(potentially changing the output), then we must regenerate the output
and then rebuild all packages.
This CL does not actually invoke go tool preprocess. That will come in
the next CL. For now, it just copies the input pprof profile.
This CL shouldn't be submitted on its own, only with the children. Since
the new action doesn't yet use the build cache, every build (even fully
cached builds) unconditionally run the PGO action.
For #58102.
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Change-Id: I594417cfb0164cd39439a03977c904e4c0c83b8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/569423
Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Robert Griesemer [Thu, 18 Apr 2024 01:40:27 +0000 (18:40 -0700)]
go/types: track gotypesalias non-default behavior
Fixes #66216.
Change-Id: I04d7389e5712b35db078844ce424e10f5b96156c
Reviewed-on: https://go-review.googlesource.com/c/go/+/579936
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
Robert Griesemer [Thu, 18 Apr 2024 00:44:55 +0000 (17:44 -0700)]
go/types, types2: use types2.Config flag to control Alias node creation
Move Checker.enableAlias to Config.EnableAlias (for types2) and
Config._EnableAlias (for go/types), and adjust all uses.
Use Config.EnableAlias to control Alias creation for types2 and
with that remove dependencies on the gotypesalias GODEBUG setting
and problems during bootstrap. The only client is the compiler and
there we simply use the desired configuration; it is undesirable
for the compiler to be dependent on gotypesalias.
Use the gotypesalias GODEBUG setting to control Config._EnableAlias
for go/types (similar to before).
Adjust some related code. We plan to remove gotypesalias eventually
which will remove some of the new discrepancies between types2 and
go/types again.
Fixes #66874.
Change-Id: Id7cc4805e7ea0697e0d023c7f510867e59a24871
Reviewed-on: https://go-review.googlesource.com/c/go/+/579935 Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Damien Neil [Thu, 4 Apr 2024 18:01:28 +0000 (11:01 -0700)]
net/http: don't cancel Dials when requests are canceled
Currently, when a Transport creates a new connection for a request,
it uses the request's Context to make the Dial. If a request
times out or is canceled before a Dial completes, the Dial is
canceled.
Change this so that the lifetime of a Dial call is not bound
by the request that originated it.
This change avoids a scenario where a Transport can start and
then cancel many Dial calls in rapid succession:
- Request starts a Dial.
- A previous request completes, making its connection available.
- The new request uses the now-idle connection, and completes.
- The request Context is canceled, and the Dial is aborted.
Fixes #59017
Change-Id: I996ffabc56d3b1b43129cbfd9b3e9ea7d53d263c
Reviewed-on: https://go-review.googlesource.com/c/go/+/576555 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Michael Anthony Knyszek [Fri, 22 Mar 2024 21:42:02 +0000 (21:42 +0000)]
internal/abi: define EmptyInterface, TypeOf, and NoEscape
This change defines two commonly-defined functions and a
commonly-defined type in internal/abi to try and deduplicate some
definitions. This is motivated by a follow-up CL which will want access
to TypeOf in yet another package.
There still exist duplicate definitions of all three of these things in
the runtime, and this CL doesn't try to handle that yet. There are far
too many uses in the runtime to handle manually in a way that feels
comfortable; automated refactoring will help.
For #62483.
Change-Id: I02fc64a28f11af618f6071f94d27f45c135fa8ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/573955
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
Roland Shoemaker [Wed, 19 Apr 2023 18:56:30 +0000 (11:56 -0700)]
crypto/tls: add a bogo shim
Run the BoGo test suite.
For now a number of tests are disabled, so that we can land the shim.
Once the shim is in the tree I'll work on fixing tests, and aligning
the TLS stack with the boringssl stack.
Eventually we should also remove the --loose-errors flag.
Fixes #51434
Change-Id: Ic8339fc34552936b798acf834011a129e375750e
Reviewed-on: https://go-review.googlesource.com/c/go/+/486495
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Roland Shoemaker <roland@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
Than McIntosh [Thu, 11 Apr 2024 15:16:22 +0000 (15:16 +0000)]
cmd/compile/internal/ssa: delay rewrite cycle detection for huge funcs
The SSA rewrite pass has some logic that looks to see whether a
suspiciously large number of rewrites is happening, and if so, turns
on logic to try to detect rewrite cycles. The cycle detection logic is
quite expensive (hashes the entire function), meaning that for very
large functions we might get a successful compilation in a minute or
two with no cycle detection, but take a couple of hours once cycle
detection kicks in.
This patch moves from a fixed limit of 1000 iterations to a limit set
partially based on the size of the function (meaning that we'll wait
longer before turning cycle detection for a large func).
Fixes #66773.
Change-Id: I72f8524d706f15b3f0150baf6abeab2a5d3e15c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/578215
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Jes Cok [Thu, 11 Apr 2024 17:52:37 +0000 (01:52 +0800)]
net/http: add ParseCookie, ParseSetCookie
Fixes #66008
Change-Id: I64acb7da47a03bdef955f394682004906245a18b
Reviewed-on: https://go-review.googlesource.com/c/go/+/578275 Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Change-Id: I2750a744d0dcf636a00d388299e1f2f993e5ac26
Reviewed-on: https://go-review.googlesource.com/c/go/+/572575
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Robert Griesemer [Mon, 15 Apr 2024 21:10:40 +0000 (14:10 -0700)]
types2: flip the default value of GODEBUG=gotypesalias=1
This CL changes the interpretation of the unset value
of gotypesalias to not equal "0".
This is a port of CL 577715 from go/types to types2,
with adjustments to go/types to keep the source code
in sync. Specifically:
- Re-introduce testing of both modes (gotypesalias=0,
gotypesalias=1) in go/types.
- Re-introduce setting of gotypesalias in some of the
tests for explicit documentation in go/types.
The compiler still uses the (now) non-default setting
due to a panic with the default setting that needs to
be debugged.
Also, the type checkers still don't call IncNonDefault
when the non-default setting of gotypesalias is used.
Change-Id: I1feed3eb334c202950ac5aadf49a74adcce0d8c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/579076
TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
David Chase [Mon, 15 Apr 2024 21:53:14 +0000 (17:53 -0400)]
runtime/pprof: test for Darwin flake in TestVMInfo
If it contains
"No process corpse slots currently available, waiting to get one"
skip the test in short mode, so that run.bash works reliably
on developer laptops, but the flake is still recorded on builders.
The problem also seems to get better after a laptop reboot?
Updates #62352.
Change-Id: I12e8f594f0b830bacda5d8bfa594782345764c4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/579295
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Change-Id: I95d6ac49ff6b64aa678e6896f57af9d85c923aad
Reviewed-on: https://go-review.googlesource.com/c/go/+/579235 Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Paul Murphy <murp@ibm.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Replace these incorrect fullwidth brackets with halfwidth brackets.
Change-Id: Ie17561c18334f9c07eedbff79e5f64ed4fc281bd
GitHub-Last-Rev: 94214be6cea75b4d1fa7b536cac523f061614d38
GitHub-Pull-Request: golang/go#66846
Reviewed-on: https://go-review.googlesource.com/c/go/+/579117 Reviewed-by: qiu laidongfeng2 <2645477756@qq.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Ian Lance Taylor [Mon, 5 Feb 2024 22:56:54 +0000 (14:56 -0800)]
doc: fix tense in godebug (s/revert/reverted)
Change-Id: Ida6ed22102a6da36739c7581aeab297fdd7bc9f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/561715 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Dmitri Shuralyov [Mon, 15 Apr 2024 23:54:01 +0000 (19:54 -0400)]
runtime: remove no-op slice operation in Caller
rpc was an array prior to CL 152537, so it was necessary to slice
it since callers accepts a slice. Now that rpc is already a slice,
slicing it is no longer required.
Change-Id: Ie646ef5e494323c9fb58f3a24f942e3b1ff639ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/579016 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Ian Lance Taylor [Mon, 15 Apr 2024 17:14:57 +0000 (10:14 -0700)]
debug/elf: define non-standard but well-known symbol types
Fixes #66836
Change-Id: I603faca2acd2bcffabbcaca8b8670d46387d2a5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/578995
Commit-Queue: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Michael Podtserkovskii [Fri, 5 Apr 2024 12:58:35 +0000 (13:58 +0100)]
cmd/cgo: create -objdir if not exist
Currently the directory is created only if -objdir is omited.
Creating the directory here is useful to avoid doing this in each build system.
And also this is consistent with similar flags of other tools like `-o`.
Change-Id: Ic39d6eb3e003bc4884089f80f790e30df4a54b01
Reviewed-on: https://go-review.googlesource.com/c/go/+/576815 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Alan Donovan [Fri, 12 Apr 2024 20:08:22 +0000 (16:08 -0400)]
os: make File.Readdir et al concurrency-safe
Before, all methods of File (including Close) were
safe for concurrent use (I checked), except the three
variants of ReadDir.
This change makes the ReadDir operations
atomic too, and documents explicitly that all methods
of File have this property, which was already implied
by the package documentation.
Fixes #66498
Change-Id: I05c88b4e60b44c702062e99ed8f4a32e7945927a
Reviewed-on: https://go-review.googlesource.com/c/go/+/578322 Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Change-Id: Ied95386a346be38ccda86d332d09b2089a68c5e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/579075
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
Alan Donovan [Tue, 9 Apr 2024 19:20:21 +0000 (15:20 -0400)]
go/types: flip the default value of GODEBUG=gotypesalias=1
This CL changes the interpretation of the unset value
of gotypesalias to equal "1". The actual deletion of
all the transitional logic will happen in a follow-up.
Note that the compiler still interprets unset as "0".
More work appears to be required within the compiler
before it is safe to flip its default.
Change-Id: I854ab1fd856c7c361a757676b0670e2f23402816
Reviewed-on: https://go-review.googlesource.com/c/go/+/577715 Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
compress/bzip2: simplify Huffman tree construction
This change simplifies the construction of the Huffman tree in the
bzip2 package by replacing custom sort logic with the more concise and
idiomatic use of "slices" and "cmp" packages.
Change-Id: I2a8aef146b54b9433038b133d2cc8856ba077c72
GitHub-Last-Rev: c031bb56635552205c12b87add5f4337a7def74f
GitHub-Pull-Request: golang/go#66817
Reviewed-on: https://go-review.googlesource.com/c/go/+/578438 Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Guoqi Chen [Tue, 15 Aug 2023 18:09:49 +0000 (02:09 +0800)]
cmd/internal/obj/loong64: recheck jump offset boundary after auto-aligning loop heads
After the alignment of the loop header is performed, the offset of the checked
conditional branch instruction may overflow, so it needs to be checked again.
When checking whether the offset of the branch jump instruction overflows, it
can be classified and processed according to the range of the immediate field
of the specific instruction, which can reduce the introduction of unnecessary
jump instructions.
Fixes #61819
Change-Id: I772a5b5b8b8de21c78d7566be30be8ff65fdbce8
Reviewed-on: https://go-review.googlesource.com/c/go/+/519915 Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn> Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Meidan Li <limeidan@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: qiu laidongfeng2 <2645477756@qq.com> Reviewed-by: WANG Xuerui <git@xen0n.name>
The "rt" seems to be caused after copy-pasting the previous "wt" block
which make sense as WriterTo, but for ReaderFrom it makes more sense
thinking of rf instead of rt.
Change-Id: I873699c27211bea6cdba3e199f36eb3c38188d70
GitHub-Last-Rev: 1795600a9b29946d824ba645c137da216bdf6302
GitHub-Pull-Request: golang/go#66811
Reviewed-on: https://go-review.googlesource.com/c/go/+/578635 Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
Carlos Amedee [Tue, 2 Apr 2024 22:16:07 +0000 (18:16 -0400)]
runtime, cmd/trace: remove code paths that include v1 tracer
This change makes the new execution tracer described in #60773, the
default tracer. This change attempts to make the smallest amount of
changes for a single CL.
Updates #66703
For #60773
Change-Id: I3742f3419c54f07d7c020ae5e1c18d29d8bcae6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/576256 Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
cmd/pprof: close resp body after the profile.Parse is called
Change-Id: I5bccef3c46072e388bfe9985e70745853f673a42
GitHub-Last-Rev: adee7b9f7fa21c3ee5561b8233bbfe94168e45ed
GitHub-Pull-Request: golang/go#66829
Reviewed-on: https://go-review.googlesource.com/c/go/+/578875 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Change-Id: I7507e6cff00d027fd7840e0661499efc63353f6e
GitHub-Last-Rev: 81348ed39d055e445d943eedfe4b4db3a1fd73d8
GitHub-Pull-Request: golang/go#66820
Reviewed-on: https://go-review.googlesource.com/c/go/+/578441
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Andy Pan [Mon, 8 Apr 2024 03:51:45 +0000 (11:51 +0800)]
net: implement TCP_KEEPIDLE, TCP_KEEPINTVL, and TCP_KEEPCNT on Solaris 11.4
Also simulate TCP_KEEPIDLE, TCP_KEEPINTVL, and TCP_KEEPCNT with
TCP_KEEPALIVE_THRESHOLD + TCP_KEEPALIVE_ABORT_THRESHOLD for
Solaris prior to 11.4
Fixes #9614
Fixes #64251
Change-Id: Ia0777076a7952630bc52761cddd0b06b0d81c6a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/577195
Commit-Queue: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Change-Id: I3eb41562bf6478b288d9f41915fd7d027399a6ba
GitHub-Last-Rev: 218b9cb0672f0be18834733c0907a244a8cfcfd9
GitHub-Pull-Request: golang/go#66551
Reviewed-on: https://go-review.googlesource.com/c/go/+/574575 Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Change-Id: Iab8c415555ab85097be6d2d133b3349c5219a23b
GitHub-Last-Rev: 8a8177b9af5509ebbaa701b06c79126aae7510a8
GitHub-Pull-Request: golang/go#63348
Reviewed-on: https://go-review.googlesource.com/c/go/+/532217
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Andy Pan [Thu, 4 Apr 2024 08:30:30 +0000 (16:30 +0800)]
net: separate the Solaris fast/slow path of setting SOCK_* from others
Along with the removal of the slow path from Linux and *BSD.
For #59359
Change-Id: I6c79594252e5e5f1c1c57c11e09458fcae3793d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/577175 Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Andy Pan [Thu, 28 Mar 2024 07:08:38 +0000 (15:08 +0800)]
net: bifurcate the TCP Keep-Alive mechanism into Solaris and illumos
Fixes #65812
Change-Id: I63facb32eeddbe9b6e0279f1c039779ba2e2ab7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/575015
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
Commit-Queue: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Andy Pan [Wed, 10 Apr 2024 08:48:09 +0000 (16:48 +0800)]
runtime: utilize EVFILT_USER to wake up kevent for kqueue
Fixes #66760
Change-Id: I6ba5bc5b00506b66cb8dc3984a61f32a6358d9bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/577895
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Jes Cok [Thu, 11 Apr 2024 14:25:27 +0000 (22:25 +0800)]
doc: make use of simpler symbol links for relnotes
This is a practical use of CL 577915, follow-up to CL 577835.
Change-Id: Ibe7e2fa11b444afa1898dc6f6aba1512fe98f1fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/578195 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Ian Lance Taylor [Thu, 11 Apr 2024 22:10:47 +0000 (15:10 -0700)]
os: document file mode of temporary files
Fixes #66784
Change-Id: Ifd17e0830e04e7028d8a876c6c12c496f5167887
Reviewed-on: https://go-review.googlesource.com/c/go/+/578395
Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Change-Id: I449fcb008fa4c1f51de0bef9f016907d8b99da67
GitHub-Last-Rev: b2e84f1a8a96199e1f9e4ae548225273e2ec94c0
GitHub-Pull-Request: golang/go#66772
Reviewed-on: https://go-review.googlesource.com/c/go/+/578135 Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Michael Anthony Knyszek [Thu, 11 Apr 2024 21:27:08 +0000 (21:27 +0000)]
cmd/trace/v2: make the -pprof actually useful
In both the v1 and v2 cmd/trace, pprofMatchingGoroutines will generate
no output at all if the filter name passed to it is the empty string.
This is rather pointless because there are at least two places where we
don't pass a name to filter. Modify pprofMatchingGoroutines to include
*all* goroutines in the trace if the name to filter by is not specified.
For #66782.
Change-Id: I6b72298d676bc93892b075a7426e6e56bc6656c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/578356
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Michael Anthony Knyszek [Thu, 11 Apr 2024 20:30:24 +0000 (20:30 +0000)]
cmd/trace/v2: handle the -pprof flag
Turns out we ported all the profile generation, but forgot to actually
support the command line flags for them! This change fixes the issue by
handling the different kinds of profiles and writing them out to stdout.
Fixes #66782.
Change-Id: I7756fb4636ce8daaf11ed471be79c86ce3d463cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/578318 Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Ian Lance Taylor [Thu, 11 Apr 2024 21:36:25 +0000 (14:36 -0700)]
net: check SkipAdditional error result
This will avoid a potential endless loop for a corrupt DNS packet.
For #66754
Change-Id: I46591b3f7695bcc88d2312833e45955f8c129d2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/578375 Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Michael Anthony Knyszek [Thu, 11 Apr 2024 20:33:20 +0000 (20:33 +0000)]
internal/trace/v2: make TestGCStress less random
Currently TestGCStress' main loop allocates a randomly-sized byte slice
in a loop. On the windows-386 builder, it looks like the following is
happening.
In such heavily-allocating scenarios, the test seems to be able to
outrun the GC. This is a known issue on all platforms, but it looks to
me like there may be a real issue with mark termination. (Fixing that is
outside the scope of this change, but relevant here.)
Furthermore, while the test is ramping up, the pacer is taking time to
acclimate to the high allocation rate. This is probably made worse due
to the coarse time granularity on Windows, since the pacer relies on
accurate time measurements.
Because the pacer is ramping up, it isn't starting early enough, causing
a lot of memory to get allocated black and inflate the live heap size.
This happens for more than one cycle.
Last but not least, because the core allocating loop of this test
allocates randomly-sized byte slices, we could just get unlucky and
inflate the live heap by much more sometimes. Furthermore, the
randomness creates chaos for the pacer that is totally unnecessary for
this test.
Although I couldn't reproduce the issue we're seeing on the trybots in a
gomote, I *could* reproduce memory spikes in general. These memory
spikes always occurred before the pacer had a chance to "warm up," in
the first two cycles after the heavy allocating begins.
I believe the flakiness we're seeing is all of these factors lining up,
because if I just make the size of the allocated byte slices smaller and
non-random, I can no longer reproduce the memory spikes. This change
implements this as a fix in the hope that it'll resolve the flakiness.
Fixes #66624.
Change-Id: I478d45e7c600e5aee4b21dbe831e1f287284f5e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/578319 Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Joe Tsai [Mon, 1 Apr 2024 20:13:50 +0000 (13:13 -0700)]
all: consistently use "IEEE 754" over "IEEE-754"
There is no hyphen between the organization and the number.
For example, https://standards.ieee.org/ieee/754/6210/
shows the string "IEEE 754-2019" and not "IEEE-754-2019".
This assists in searching for "IEEE 754" in documentation
and not missing those using "IEEE-754".
Change-Id: I9a50ede807984ff1e2f17390bc1039f6a5d162e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/575438
Run-TryBot: Joseph Tsai <joetsai@digital-static.net> Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Johan Brandhorst-Satzkorn [Sun, 7 Apr 2024 16:27:11 +0000 (09:27 -0700)]
misc/wasm: drop wasmtime < 14 support
For Go 1.23, we decided to no longer support the old CLI interface
exposed by wasmtime. This removes the extra logic included to support
both the new and the old CLI interface. Now only versions of wasmtime
14 and newer are supported.
Fixes #63718
Change-Id: Iea31388dc41bc8d73caa923c7e4acae2228bf515
Reviewed-on: https://go-review.googlesource.com/c/go/+/577135 Reviewed-by: Randy Reddig <randy.reddig@fastly.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Use "slices.Equal" instead of "reflect.DeepEqual".
Replace unnecessary helper type "byIndex" with "slices.SortFunc".
No effect on benchmarks.
Change-Id: I1fb2768ea6d9db7f487408fa109343be3f1741d5
GitHub-Last-Rev: 8429bc145272ae620fcd001b1de393bf3c0b6108
GitHub-Pull-Request: golang/go#66646
Reviewed-on: https://go-review.googlesource.com/c/go/+/575715 Reviewed-by: qiu laidongfeng2 <2645477756@qq.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Roland Shoemaker [Tue, 9 Apr 2024 13:27:30 +0000 (15:27 +0200)]
image/gif: revert incorrect usage of clear
CL 570555 replaced a loop which added empty
color.RGBA elements with a call to clear.
color.Palette is a slice of interfaces, so using
clear results in a slice of nil elements, rather
than what we previously had which was empty
color.RGBA elements. This could cause a panic when
attempting to re-encode a GIF which had an
extended color palette because of the weird
transparency hack.
This was discovered by OSS-Fuzz. I've added a test
case using their reproducer in order to prevent
future regressions.
Change-Id: I00a89257d90b6cca68672173eecdaa0a24f18d9c
Reviewed-on: https://go-review.googlesource.com/c/go/+/577555 Reviewed-by: Nigel Tao <nigeltao@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Roland Shoemaker <roland@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Ian Lance Taylor [Wed, 10 Apr 2024 16:59:20 +0000 (09:59 -0700)]
internal/poll: better panic for invalid write return value
For #61060
Change-Id: I13cd73b4062cb7bd248d2a4afae06dfa29ac0203
Reviewed-on: https://go-review.googlesource.com/c/go/+/577955
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Damien Neil [Tue, 23 Jan 2024 23:59:47 +0000 (15:59 -0800)]
database/sql: avoid clobbering driver-owned memory in RawBytes
Depending on the query, a RawBytes can contain memory owned by the
driver or by database/sql:
If the driver provides the column as a []byte,
RawBytes aliases that []byte.
If the driver provides the column as any other type,
RawBytes contains memory allocated by database/sql.
Prior to this CL, Rows.Scan will reuse existing capacity in a
RawBytes to permit a single allocation to be reused across rows.
When a RawBytes is reused across queries, this can result
in database/sql writing to driver-owned memory.
Add a buffer to Rows to store RawBytes data, and reuse this
buffer across calls to Rows.Scan.
Fixes #65201
Change-Id: Iac640174c7afa97eeb39496f47dec202501b2483
Reviewed-on: https://go-review.googlesource.com/c/go/+/557917 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Michael Anthony Knyszek [Tue, 9 Apr 2024 03:09:34 +0000 (03:09 +0000)]
internal/trace/v2: halve the memory footprint of TestGCStress
This test has been OOMing on 32-bit platforms for a bit. I suspect the
very high allocation rate is causing the program to outrun the GC in
some corner-case scenarios, especially on 32-bit Windows.
I don't have a strong grasp of what's going on yet, but lowering the
memory footprint should help with the flakiness. This shouldn't
represent a loss in test coverage, since we're still allocating and
assisting plenty (tracing the latter is a strong reason this test
exists).
For #66624.
Change-Id: Idd832cfc5cde04701386919df4490f201c71130a
Reviewed-on: https://go-review.googlesource.com/c/go/+/577475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Michael Anthony Knyszek [Fri, 15 Mar 2024 22:18:06 +0000 (22:18 +0000)]
runtime: rewrite traceMap to scale better
The existing implementation of traceMap is a hash map with a fixed
bucket table size which scales poorly with the number of elements added
to the map. After a few thousands elements are in the map, it tends to
fall over.
Furthermore, cleaning up the trace map is currently non-preemptible,
without very good reason.
This change replaces the traceMap implementation with a simple
append-only concurrent hash-trie. The data structure is incredibly
simple and does not suffer at all from the same scaling issues.
Because the traceMap no longer has a lock, and the traceRegionAlloc it
embeds is not thread-safe, we have to push that lock down. While we're
here, this change also makes the fast path for the traceRegionAlloc
lock-free. This may not be inherently faster due to contention on the
atomic add, but it creates an easy path to sharding the main allocation
buffer to reduce contention in the future. (We might want to also
consider a fully thread-local allocator that covers both string and
stack tables. The only reason a thread-local allocator isn't feasible
right now is because each of these has their own region, but we could
certainly group all them together.)
Change-Id: I8c06d42825c326061a1b8569e322afc4bc2a513a
Reviewed-on: https://go-review.googlesource.com/c/go/+/570035 Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Bypass: Michael Knyszek <mknyszek@google.com> Reviewed-by: David Chase <drchase@google.com>
Michael Anthony Knyszek [Fri, 15 Mar 2024 22:15:37 +0000 (22:15 +0000)]
runtime: push down systemstack requirement for tracer where possible
Currently lots of functions require systemstack because the trace buffer
might get flushed, but that will already switch to the systemstack for
the most critical bits (grabbing trace.lock). That means a lot of this
code is non-preemptible when it doesn't need to be. We've seen this
cause problems at scale, when dumping very large numbers of stacks at
once, for example.
This is a re-land of CL 572095 which was reverted in CL 577376. This
re-land includes a fix of the test that broke on the longtest builders.
Change-Id: Ia8d7cbe3aaa8398cf4a1818bac66c3415a399348
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/577377 Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Jes Cok [Wed, 10 Apr 2024 13:00:41 +0000 (21:00 +0800)]
doc: update relnote for sync.Map.Clear
Change-Id: I28baf375502ccf3b0dfcc8250650e914ac7bae78
Reviewed-on: https://go-review.googlesource.com/c/go/+/577835
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Jes Cok <xigua67damn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Submitting changes on behalf of Josh Bleecher Snyder as authorized at
https://go-review.googlesource.com/c/go/+/547357/comment/61f8433f_04dc9c5d/
and of David Buchanan as authorized at
https://github.com/FiloSottile/mlkem768/pull/4#issuecomment-1975330952.
Updates #64537
Change-Id: I50607336282434d64a1255901b0ef40dbfd47e91
Reviewed-on: https://go-review.googlesource.com/c/go/+/550215 Reviewed-by: Roland Shoemaker <roland@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Alan Donovan [Tue, 9 Apr 2024 19:35:11 +0000 (15:35 -0400)]
cmd/api: handle types.Alias
This is covered by the existing tests under gotypesalias=1.
Change-Id: Ia17f35fe580b745fa4bdaf4689dfe9c2ed6ebc5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/577735
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Alan Donovan <adonovan@google.com>
Alan Donovan [Tue, 9 Apr 2024 16:42:37 +0000 (12:42 -0400)]
cmd/compile/internal/types2: revert to three-phase alias resolution
This change reenables the legacy three-phase resolution
(non-alias typenames, aliases, the rest) even when
GODEBUG=gotypesalias=1. Unfortunately the existing test case
for #50259 causes the simpler logic to fail.
Updates #50259
Updates #65294
Change-Id: Ibfaf8146e46760718673a916a9b220a9d678409a
Reviewed-on: https://go-review.googlesource.com/c/go/+/577616 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Than McIntosh [Wed, 3 Apr 2024 16:06:23 +0000 (16:06 +0000)]
cmd/compile/internal/liveness: enhance mergelocals for addr-taken candidates
It is possible to have situations where a given ir.Name is
non-address-taken at the source level, but whose address is
materialized in order to accommodate the needs of arch-dependent
memory ops. The issue here is that the SymAddr op will show up as
touching a variable of interest, but the subsequent memory op will
not. This is generally not an issue for computing whether something is
live across a call, but it is problematic for collecting the more
fine-grained live interval info that drives stack slot merging.
As an example, consider this Go code:
package p
type T struct {
x [10]int
f float64
}
func ABC(i, j int) int {
var t T
t.x[i&3] = j
return t.x[j&3]
}
On amd64 the code sequences we'll see for accesses to "t" might look like
Note that the the loads and stores (ex: v19, v24) all refer directly
to "t", which means that regular live analysis will work fine for
identifying variable lifetimes. The DUFFZERO is (in effect) an
indirect write, but since there are accesses immediately after it we
wind up with the same live intervals.
Here instead of memory ops that refer directly to the symbol, we take
the address of "t" (ex: v15) and then pass the address to memory ops
(where the ops themselves no longer refer to the symbol).
This patch enhances the stack slot merging liveness analysis to handle
cases like the PPC64 one above. We add a new phase in candidate
selection that collects more precise use information for merge
candidates, and screens out candidates that are too difficult to
analyze. The phase make a forward pass over each basic block looking
for instructions of the form vK := SymAddr(N) where N is a raw
candidate. It then creates an entry in a map with key vK and value
holding name and the vK use count. As the walk continues, we check for
uses of of vK: when we see one, record it in a side table as an
upwards exposed use of N. At each vK use we also decrement the use
count in the map entry, and if we hit zero, remove the map entry. If
we hit the end of the basic block and we still have map entries, this
implies that the address in question "escapes" the block -- at that
point to be conservative we just evict the name in question from the
candidate set.
Although this CL fixes the issues that forced a revert of the original
merging CL, this CL doesn't enable stack slot merging by default; a
subsequent CL will do that.
Updates #62737.
Updates #65532.
Updates #65495.
Change-Id: Id41d359a677767a8e7ac1e962ae23f7becb4031f
Reviewed-on: https://go-review.googlesource.com/c/go/+/576735 Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Than McIntosh [Fri, 5 Apr 2024 12:53:20 +0000 (12:53 +0000)]
cmd/compile/internal: small tweak to merge locals trace output
For -gcflags=-d=mergelocalstrace=1 (which reports estimated savings
from stack slot merging), emit separate values for pointerful vs
non-pointerful variables, for a bit more detail.
Updates #62737.
Updates #65532.
Updates #65495.
Change-Id: I9dd27d2a254036448c85c13d189d1ed36157c9d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/576680
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Than McIntosh [Wed, 3 Apr 2024 15:51:42 +0000 (15:51 +0000)]
cmd/compile/internal: merge stack slots for selected local auto vars
[This is a partial roll-forward of CL 553055, the main change here
is that the stack slot overlap operation is flagged off by default
(can be enabled by hand with -gcflags=-d=mergelocals=1) ]
Preliminary compiler support for merging/overlapping stack slots of
local variables whose access patterns are disjoint.
This patch includes changes in AllocFrame to do the actual
merging/overlapping based on information returned from a new
liveness.MergeLocals helper. The MergeLocals helper identifies
candidates by looking for sets of AUTO variables that either A) have
the same size and GC shape (if types contain pointers), or B) have the
same size (but potentially different types as long as those types have
no pointers). Variables must be greater than (3*types.PtrSize) in size
to be considered for merging.
After forming candidates, MergeLocals collects variables into "can be
overlapped" equivalence classes or partitions; this process is driven
by an additional liveness analysis pass. Ideally it would be nice to
move the existing stackmap liveness pass up before AllocFrame
and "widen" it to include merge candidates so that we can do just a
single liveness as opposed to two passes, however this may be difficult
given that the merge-locals liveness has to take into account
writes corresponding to dead stores.
This patch also required a change to the way ssa.OpVarDef pseudo-ops
are generated; prior to this point they would only be created for
variables whose type included pointers; if stack slot merging is
enabled then the ssagen code creates OpVarDef ops for all auto vars
that are merge candidates.
Note that some temporaries created late in the compilation process
(e.g. during ssa backend) are difficult to reason about, especially in
cases where we take the address of a temp and pass it to the runtime.
For the time being we mark most of the vars created post-ssagen as
"not a merge candidate".
Stack slot merging for locals/autos is enabled by default if "-N" is
not in effect, and can be disabled via "-gcflags=-d=mergelocals=0".
Fixmes/todos/restrictions:
- try lowering size restrictions
- re-evaluate the various skips that happen in SSA-created autotmps
Updates #62737.
Updates #65532.
Updates #65495.
Change-Id: Ifda26bc48cde5667de245c8a9671b3f0a30bb45d
Reviewed-on: https://go-review.googlesource.com/c/go/+/575415
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Michael Anthony Knyszek [Tue, 9 Apr 2024 03:56:40 +0000 (03:56 +0000)]
runtime: make zeroing of large objects containing pointers preemptible
This change makes it possible for the runtime to preempt the zeroing of
large objects that contain pointers. It turns out this is fairly
straightforward with allocation headers, since we can just temporarily
tell the GC that there's nothing to scan for a large object with a
single pointer write (as opposed to trying to zero a whole bunch of
bits, as we would've had to do once upon a time).
Fixes #31222.
Change-Id: I10d0dcfa3938c383282a3eb485a6f00070d07bd2
Reviewed-on: https://go-review.googlesource.com/c/go/+/577495
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Michael Anthony Knyszek [Tue, 9 Apr 2024 03:41:06 +0000 (03:41 +0000)]
runtime: remove the allocheaders GOEXPERIMENT
This change removes the allocheaders, deleting all the old code and
merging mbitmap_allocheaders.go back into mbitmap.go.
This change also deletes the SetType benchmarks which were already
broken in the new GOEXPERIMENT (it's harder to set up than before). We
weren't really watching these benchmarks at all, and they don't provide
additional test coverage.
Change-Id: I135497201c3259087c5cd3722ed3fbe24791d25d
Reviewed-on: https://go-review.googlesource.com/c/go/+/567200 Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Michael Anthony Knyszek [Mon, 25 Mar 2024 17:50:13 +0000 (17:50 +0000)]
runtime: account for _Pgcstop in GC CPU pause time in a fine-grained way
The previous CL, CL 570257, made it so that STW time no longer
overlapped with other CPU time tracking. However, what we lost was
insight into the CPU time spent _stopping_ the world, which can be just
as important. There's pretty much no easy way to measure this
indirectly, so this CL implements a direct measurement: whenever a P
enters _Pgcstop, it writes down what time it did so. stopTheWorld then
accumulates all the time deltas between when it finished stopping the
world and each P's stop time into a total additional pause time. The GC
pause cases then accumulate this number into the metrics.
This should cause minimal additional overhead in stopping the world. GC
STWs already take on the order of 10s to 100s of microseconds. Even for
100 Ps, the extra `nanotime` call per P is only 1500ns of additional CPU
time. This is likely to be much less in actual pause latency, since it
all happens concurrently.
Change-Id: Icf190ffea469cd35ebaf0b2587bf6358648c8554
Reviewed-on: https://go-review.googlesource.com/c/go/+/574215
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicolas Hillegeer <aktau@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Michael Anthony Knyszek [Fri, 8 Mar 2024 23:17:23 +0000 (23:17 +0000)]
runtime: remove overlap in the GC CPU pause time metrics
Currently the GC CPU pause time metrics start measuring before the STW
is complete. This results in a slightly less accurate measurement and
creates some overlap with other timings (for example, the idle time of
idle Ps) that will cause double-counting.
This CL adds a field to worldStop to track the point at which the world
actually stopped and uses that as the basis for the GC CPU pause time
metrics, basically eliminating this overlap.
Note that this will cause Ps in _Pgcstop before the world is fully
stopped to be counted as user time. A follow-up CL will fix this
discrepancy.
Change-Id: I287731f08415ffd97d327f582ddf7e5d2248a6f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/570258
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Nicolas Hillegeer <aktau@google.com>
Michael Anthony Knyszek [Fri, 8 Mar 2024 23:06:41 +0000 (23:06 +0000)]
runtime: move GC pause time CPU metrics update into the STW
This change fixes a possible race with updating metrics and reading
them. The update is intended to be protected by the world being stopped,
but here, it clearly isn't.
Fixing this lets us lower the thresholds in the metrics tests by an
order of magnitude, because the only thing we have to worry about now is
floating point error (the tests were previously written assuming the
floating point error was much higher than it actually was; that turns
out not to be the case, and this bug was the problem instead). However,
this still isn't that tight of a bound; we still want to catch any and
all problems of exactness. For this purpose, this CL adds a test to
check the source-of-truth (in uint64 nanoseconds) that ensures the
totals exactly match.
This means we unfortunately have to take another time measurement, but
for now let's prioritize correctness. A few additional nanoseconds of
STW time won't be terribly noticable.
Fixes #66212.
Change-Id: Id02c66e8a43c13b1f70e9b268b8a84cc72293bfd
Reviewed-on: https://go-review.googlesource.com/c/go/+/570257
Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Nicolas Hillegeer <aktau@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>