Michael Pratt [Wed, 6 Dec 2023 19:20:49 +0000 (14:20 -0500)]
internal/profile: remove legacy profile support
internal/profile.Parse is only used in two places: cmd/compile for
parsing PGO profiles, and net/http/pprof for parsing runtime/pprof
profiles for delta profiles. Neither case ever encounters legacy
profiles, so we can remove support entirely from the package.
Dmitri Shuralyov [Wed, 31 Jan 2024 18:30:50 +0000 (13:30 -0500)]
doc/go1.22: move go/version package mention into a separate heading
It's a new package in the standard library,
not a minor change to an existing package.
For #62039.
For #61422.
Change-Id: I7488304cd2bd6353f535cab192d015796840ba4e
Reviewed-on: https://go-review.googlesource.com/c/go/+/559799
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
codesoap [Wed, 31 Jan 2024 18:31:56 +0000 (18:31 +0000)]
container/heap: remove confusing claim of memory leak
The term "memory leak" was misused here, as the memory is still referenced
by the slice.
Fixes #65403
Change-Id: Id102419d4c798fb2a4ec8be86be9ec9b5cdd98e6
GitHub-Last-Rev: 3febcd0ba4ab5897bef8f2d7ded594ef09932771
GitHub-Pull-Request: golang/go#65404
Reviewed-on: https://go-review.googlesource.com/c/go/+/559775
Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Robert Griesemer [Wed, 31 Jan 2024 01:16:12 +0000 (17:16 -0800)]
go/token: correct out-of-bounds token offsets and positions
Per the discussion on the issue, make methods that depend on
incoming offsets or positions tolerant in the presence of
out-of-bounds values by adjusting the values as needed.
Add an internal flag debug that can be set to enable the old
(not fault-tolerant) behavior.
Fixes #57490.
Change-Id: I8a7d422b9fd1d6f0980fd4e64da2f0489056d71e
Reviewed-on: https://go-review.googlesource.com/c/go/+/559436 Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
Russ Cox [Wed, 24 Jan 2024 21:29:20 +0000 (16:29 -0500)]
go/version: fix package to accept go1.21.0-bigcorp
The proposal discussion made clear that suffixes should be accepted,
so that people who use custom VERSION files can still pass runtime.Version()
to this code. But we forgot to do that in the CL. Do that.
Note that cmd/go also strips space- and tab-prefixed suffixes,
but go.dev/doc/toolchain only mentions dash, so this code only
strips dash.
Fixes #65061.
Change-Id: I6a427b78f964eb41c024890dae30223beaef13eb
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/559796
TryBot-Bypass: Russ Cox <rsc@golang.org> Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com>
Alan Donovan [Thu, 7 Dec 2023 23:02:40 +0000 (18:02 -0500)]
runtime/debug: SetCrashOutput sets the FD for fatal panics
This feature makes it possible to record unhandled panics
in any goroutine through a watchdog process (e.g. the same
application forked+exec'd as a child in a special mode)
that can process the panic report, for example by sending
it to a crash-reporting system such as Go telemetry
or Sentry.
Fixes #42888
Change-Id: I5aa7be8f726bbc70fc650540bd1a14ab60c62ecb
Reviewed-on: https://go-review.googlesource.com/c/go/+/547978 Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Russ Cox <rsc@golang.org>
Cherry Mui [Thu, 30 Nov 2023 00:17:22 +0000 (19:17 -0500)]
runtime: preempt more aggressively when panicking
When we are crashing from an unrecovered panic, we freeze the
world, and print stack traces for all goroutines if GOTRACEBACK is
set to a high enough level. Freezing the world is best effort, so
there could still be goroutines that are not preempted, and so its
stack trace is unavailable and printed as "goroutine running on
other thread".
As we're crashing and not resuming execution on preempted
goroutines, we can make preemption more aggressive, preempting
cases that are not safe for resumption or stack scanning. This may
make goroutines more likely to be preempted in freezing the world
and have their stacks available.
Change-Id: Ie16269e2a05e007efa61368b695addc28d7a97ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/546135
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Russ Cox [Mon, 29 Jan 2024 17:00:10 +0000 (12:00 -0500)]
fmt: revert "don't pad strings with zeros"
This reverts CL 555776 (commit 704401ffa06).
Scores of tests break inside Google, and there was a test for the old behavior,
so clearly we thought it was correct at one point.
// IPv4toISO create ISO address base on a given IPv4 address.
func IPv4toISO(v4 string) (string, error) {
if net.ParseIP(v4).To4() == nil {
return "", fmt.Errorf("invalid IPv4 address")
}
s := strings.Split(v4, ".")
var ss string
for _, n := range s {
ss = ss + fmt.Sprintf("%03s", n)
}
if len(ss) != 12 {
return "", fmt.Errorf("invalid IPv4 address")
}
return fmt.Sprint("49.0001." + ss[0:4] + "." + ss[4:8] + "." + ss[8:12] + ".00"), nil
}
This is doing the weird but apparently standard conversion from
IPv4 to ISO ISIS Area 1 (see for example [1]).
Here is an example from github.com/netbirdio/netbird:
base62.Encode returns a string no leading zeros; the %06s adds leading zeros.
Are there other ways to write these examples? Yes.
Has all this code worked until now? Also yes.
The change to this behavior observed that right padding doesn't
add zeros, only left padding, but that makes sense: in numbers
without decimal points, zeros on the left preserve the value
while zeros on the right change it.
Since we agree that this case is probably not important either way,
preserve the long-time behavior of %0s.
Will document it in a followup CL: this is a clean revert.
Andy Pan [Wed, 24 Jan 2024 03:22:14 +0000 (11:22 +0800)]
net/textproto: reject HTTP requests with empty header keys
According to RFC 7230, empty field names in HTTP header are invalid.
However, there are no specific instructions for developers to deal
with that kind of case in the specification. CL 11242 chose to skip
it and do nothing about it, which now seems like a bad idea because
it has led `net/http` to behave inconsistently with the most widely-used
HTTP implementations: Apache, Nginx, Node with llhttp, H2O, Lighttpd, etc.
in the case of empty header keys.
There is a very small chance that this CL will break a few existing HTTP clients.
Fixes #65244
Change-Id: Ie01e9a6693d27caea4d81d1539345cf42b225535
Reviewed-on: https://go-review.googlesource.com/c/go/+/558095 Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Alan Donovan [Fri, 26 Jan 2024 16:19:22 +0000 (11:19 -0500)]
doc/README: clarify instructions
- State that new markdown files belong in doc/next.
- Give hints on correct markdown syntax.
For #64169
Change-Id: Ied70e7ac443530c910eea2992ca6e303bbc10499
Reviewed-on: https://go-review.googlesource.com/c/go/+/558855 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> 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>
Matthew Dempsky [Thu, 25 Jan 2024 23:51:22 +0000 (15:51 -0800)]
cmd/compile/internal/noder: preserve alias uses in export data
This CL changes the export data format to preserve alias uses.
Previously they were stripped away with types2.Unalias. For backwards
compatibility, we use pkgbits.TypeNamed, which is already used for the
predeclared aliases byte, rune, and any.
While here, remove unnecessary uses of types2.Unalias, and add a
missing one in recvBase to handle:
type T int
type A = T
func (*A) m() {}
Change-Id: I62ddb0426080a44436054964a90ab250bcd8df12
Reviewed-on: https://go-review.googlesource.com/c/go/+/558577 Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Keith Randall [Mon, 3 Jul 2023 20:49:26 +0000 (13:49 -0700)]
runtime: print exported methods from the runtime in tracebacks
We currently suppress runtime frames in tracebacks, except for
exported functions.
This CL also prints exported methods of exported types
in tracebacks, for consistency.
Change-Id: Ic65e7611621f0b210de5ae0c02b9d0a044f39fd6
Reviewed-on: https://go-review.googlesource.com/c/go/+/507736 Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Michael Pratt [Tue, 30 Jan 2024 16:01:05 +0000 (11:01 -0500)]
runtime: avoid new linkname for goroutine profiles
CL 464349 added a new linkname to provide gcount to runtime/pprof to
avoid a STW when estimating the goroutine profile allocation size.
However, adding a linkname here isn't necessary for a few reasons:
1. We already export gcount via NumGoroutines. I completely forgot about
this during review.
2. aktau suggested that goroutineProfileWithLabelsConcurrent return
gcount as a fast path estimate when the input is empty.
The second point keeps the code cleaner overall, so I've done that.
For #54014.
Change-Id: I6cb0811a769c805e269b55774cdd43509854078e
Reviewed-on: https://go-review.googlesource.com/c/go/+/559515
Auto-Submit: Michael Pratt <mpratt@google.com>
Auto-Submit: Nicolas Hillegeer <aktau@google.com> Reviewed-by: Nicolas Hillegeer <aktau@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Alessandro Arzilli [Wed, 24 Jan 2024 17:10:47 +0000 (18:10 +0100)]
cmd/link: add DW_AT_go_runtime_type to unsafe.Pointer and fix it for
uintptr
Adds the DW_AT_go_runtime_type attribute to the debug_info entry for
unsafe.Pointer (which is special) and fixes the debug_info entry of
uintptr so that its DW_AT_go_runtime_type attribute has the proper
class (it was accidentally using DW_CLS_ADDRESS instead of
DW_CLS_GO_TYPEREF)
Change-Id: I52e18593935fbda9bc425e849f4c7f50e9144ad4
Reviewed-on: https://go-review.googlesource.com/c/go/+/558275 Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Michael Pratt [Mon, 29 Jan 2024 23:57:14 +0000 (23:57 +0000)]
Revert "runtime: disable use of runnext on wasm"
This reverts CL 557437.
Reason for revert: Appears to have broken wasip1 builders.
For #65178.
Change-Id: I59c1a310eb56589c768536fe444c1efaf862f8b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/559237
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Michael Pratt [Mon, 22 Jan 2024 22:50:44 +0000 (17:50 -0500)]
runtime: disable use of runnext on wasm
When readying a goroutine, the scheduler typically places the readied
goroutine in pp.runnext, which will typically be the next goroutine to
run in the schedule.
In order to prevent a set of ping-pong goroutines from simply switching
back and forth via runnext and starving the rest of the run queue, a
goroutine scheduled via runnext shares a time slice (pp.schedtick) with
the previous goroutine.
sysmon detects "long-running goroutines", which really means Ps using
the same pp.schedtick for too long, and preempts them to allow the rest
of the run queue to run. Thus this avoids starvation via runnext.
However, wasm has no threads, and thus no sysmon. Without sysmon to
preempt, the possibility for starvation returns. Avoid this by disabling
runnext entirely on wasm. This means that readied goroutines always go
on the end of the run queue and thus cannot starve via runnext.
Note that this CL doesn't do anything about single long-running
goroutines. Without sysmon to preempt them, a single goroutine that
fails to yield will starve the run queue indefinitely.
For #65178.
Cq-Include-Trybots: luci.golang.try:gotip-js-wasm,gotip-wasip1-wasm_wasmtime,gotip-wasip1-wasm_wazero
Change-Id: I7dffe1e72c6586474186b72f8068cff77b661eae
Reviewed-on: https://go-review.googlesource.com/c/go/+/557437
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
Michael Pratt [Thu, 25 Jan 2024 20:39:09 +0000 (15:39 -0500)]
net/http: allow nothingWrittenError in TestTransportPersistConnReadLoopEOF
Flakes in #64317 are a result of a race where the server shutdown
schedules ahead of the client read loop. Normal network latency usually
hides this, but wasm's net_fake.go has very low latency.
Explicitly allow the results of this race in the test.
For #64317.
Change-Id: I9c2572fb44643762fe3f3d7cb133d7e7a8a47881
Reviewed-on: https://go-review.googlesource.com/c/go/+/558595
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Bryan C. Mills [Fri, 26 Jan 2024 17:23:01 +0000 (12:23 -0500)]
net: in the fake implementation, allow writes to buffer on closed connections
This mimics the apparent behavior of writes on linux/amd64, in which a
write on an already-closed connection silently succeeds — even if the
connection has already been closed by the remote end — provided that
the packet fits in the kernel's send buffer.
I tested this by patching in CL 557437 and running the test on js/wasm
and wasip1/wasm locally.
Fixes #64317.
Change-Id: I43f6a89e5059115cb61e4ffc33a8371057cb67a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/558915
Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Michael Matloob [Wed, 3 Jan 2024 19:23:49 +0000 (14:23 -0500)]
cmd/go/internal/list: make a copy of the package before zeroing fields
go list -json=<fields> zeroes out the fields in the package struct
that aren't specified. The problem with this is that some of the fields
have references into other fields: specifically, the NoGoError's
Error() function accesses the package struct's Dir field, so if we
clear it out the error will just print out "no Go files in" without a
directory. Instead, make a copy of the package struct before we zero
out the fields so the original values are still there.
Michael Pratt [Tue, 23 Jan 2024 18:29:23 +0000 (13:29 -0500)]
runtime: use channels in gcBgMarkStartWorkers
gcBgMarkStartWorkers currently starts workers one at a time, using a
note to communicate readiness back from the worker.
However, this is a pretty standard goroutine, so we can just use a
channel to communicate between the goroutines.
In addition to being conceptually simpler, using channels has the
additional advantage of coordinating with the scheduler. Notes use OS
locks and sleep the entire thread, requiring other threads to run the
other goroutines. Waiting on a channel allows the scheduler to directly
run another goroutine. When the worker sends to the channel, the
scheduler can use runnext to run gcBgMarkStartWorker immediately,
reducing latency.
We could additionally batch start all workers and then wait only once,
however this would defeate runnext switching between the workers and
gcBgMarkStartWorkers, so in a heavily loaded system, we expect the
direct switches to reduce latency.
Change-Id: Iedf0d2ad8ad796b43fd8d32ccb1e815cfe010cb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/558535
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Robert Griesemer [Wed, 24 Jan 2024 20:42:11 +0000 (12:42 -0800)]
go/types, types2: use existing case-insensitive lookup (remove TODO)
Rather than implementing a new, less complete mechanism to check
if a selector exists with different capitalization, use the
existing mechanism in lookupFieldOrMethodImpl by making it
available for internal use.
Pass foldCase parameter all the way trough to Object.sameId and
thus make it consistently available where Object.sameId is used.
From sameId, factor out samePkg functionality into stand-alone
predicate.
Do better case distinction when reporting an error for an undefined
selector expression.
Cleanup.
Change-Id: I7be3cecb4976a4dce3264c7e0c49a320c87101e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/558315 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Russ Cox [Tue, 23 Jan 2024 17:02:50 +0000 (12:02 -0500)]
all: enable range-over-func in Go 1.23
GOEXPERIMENT=rangefunc still enables it for all Go modules.
Otherwise only enable in Go 1.23 source files.
More work remains but it will be done in follow-up issues.
Fixes #61405.
Change-Id: Icad64942deb152ee65444e4d7be289814a8a0b6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/557835 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>
Russ Cox [Tue, 23 Jan 2024 19:42:42 +0000 (14:42 -0500)]
maps: correct use of linkname
Linkname should have uses at both ends,
and then no fake assembly file is needed.
Change-Id: Ia2066be7b1e08d71a6db622d2a167f1b09cb7d9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/558297 Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Meng Zhuo [Tue, 1 Aug 2023 14:17:02 +0000 (22:17 +0800)]
cmd/compile: implement float min/max in hardware for riscv64
CL 514596 adds float min/max for amd64, this CL adds it for riscv64.
The behavior of the RISC-V FMIN/FMAX instructions almost match Go's
requirements.
However according to RISCV spec 8.3 "NaN Generation and Propagation"
>> if at least one input is a signaling NaN, or if both inputs are quiet
>> NaNs, the result is the canonical NaN. If one operand is a quiet NaN
>> and the other is not a NaN, the result is the non-NaN operand.
Go using quiet NaN as NaN and according to Go spec
>> if any argument is a NaN, the result is a NaN
This requires the float min/max implementation to check whether one
of operand is qNaN before float mix/max actually execute.
Change-Id: Iab48be6d32b8882044fb8c821438ca8840e5493d
Reviewed-on: https://go-review.googlesource.com/c/go/+/514775 Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Run-TryBot: M Zhuo <mengzhuo1203@gmail.com> Reviewed-by: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Robert Griesemer [Wed, 24 Jan 2024 21:09:55 +0000 (13:09 -0800)]
go/types, types2: in struct processing, set name position in types2
As a consequence, the positions needed by the Checker.structType
internal helper functions add and addInvalid are always the positions
of the provided identifiers, and we can leave away the extra position
arguments.
Change-Id: Iddc275c83d3781261476b8e1903050e0a049957c
Reviewed-on: https://go-review.googlesource.com/c/go/+/558316
Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@google.com>
Michael Anthony Knyszek [Thu, 25 Jan 2024 17:23:15 +0000 (17:23 +0000)]
internal/testenv: support the LUCI mobile builders in tests
This change updates the testenv tests to correctly match on future LUCI
builder names for mobile builders. This isn't a problem today because
those haven't been set up yet, but the builder names are structured and
it's clear where the modifiers will appear. Might as well set them up
now.
Change-Id: I244b88a62a90312c0f3ff2360527d58531070362
Reviewed-on: https://go-review.googlesource.com/c/go/+/558597 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Michael Anthony Knyszek [Thu, 25 Jan 2024 17:13:11 +0000 (17:13 +0000)]
internal/testenv: allow "-noopt" anywhere in builder name in test
testenv's TestHasGoBuild test is supposed to allow noopt builders to not
have go build, but the pattern match is failing on the LUCI builders
where a test shard might have an additional "-test_only" suffix in the
builder name. Furthermore, in the LUCI world, "run mods" (the builder
type suffixes) are supposed to be well-defined and composable, so it
doesn't make sense to restrict "-noopt" to the builder suffix anyway.
This change modifies the test to allow "-noopt" to appear anywhere in
the builder name when checking if it's running on a noopt builder.
Change-Id: I393818e3e8e452c7b0927cbc65726d552aa8ff8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/558596
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> Reviewed-by: Bryan Mills <bcmills@google.com>
Cosmos Nicolaou [Thu, 25 Jan 2024 19:55:38 +0000 (11:55 -0800)]
runtime/pprof: fix retry logic introduced by #858cd8d
The previous attempt to fix this flake was incorrect in that it
examined the vmmap output rather than the detailed error
output for the 'resource shortage' message that triggers the
retry, and hence failed to retry. This PR looks at the
detailed error output.
Fixes #62352
Change-Id: I4218b187528a95842556dc1ea27947ffcbfbc497
Reviewed-on: https://go-review.googlesource.com/c/go/+/558575
Auto-Submit: 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> Reviewed-by: Michael Pratt <mpratt@google.com>
Joel Sing [Sat, 17 Sep 2022 16:37:36 +0000 (02:37 +1000)]
cmd/dist,internal/platform,runtime: add cgo support for openbsd/riscv64 port
Updates #55999
Change-Id: Ie9a030130713f3eaf789b91d9033be3335eb9d75
Reviewed-on: https://go-review.googlesource.com/c/go/+/518630 Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Joel Sing [Fri, 4 Aug 2023 10:40:23 +0000 (20:40 +1000)]
cmd/dist,internal/platform: enable openbsd/riscv64 port
Fixes #55999
Change-Id: If76b61b660db3fefe5f9ca97500782f2a650db25
Reviewed-on: https://go-review.googlesource.com/c/go/+/518629 Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org>
Mauri de Souza Meneguzzo [Sat, 2 Dec 2023 15:04:52 +0000 (15:04 +0000)]
runtime: add crash stack support for s390x
Change-Id: Ie923f7bbe5ef22e381ae4f421387fbd570622a28
GitHub-Last-Rev: f8f21635025eb6e26c6994679995ade501e870cf
GitHub-Pull-Request: golang/go#63908
Reviewed-on: https://go-review.googlesource.com/c/go/+/539296
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Mauri de Souza Meneguzzo <mauri870@gmail.com> Reviewed-by: Joel Sing <joel@sing.id.au>
Andy Pan [Fri, 22 Dec 2023 13:49:46 +0000 (21:49 +0800)]
net: verify if internal/poll.Splice has been called during io.Copy
Change-Id: I29ef35b034cd4ec401ac502bf95dbd8c3ef2a2d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/552535
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Damien Neil <dneil@google.com>
Robert Griesemer [Tue, 23 Jan 2024 21:21:19 +0000 (13:21 -0800)]
go/types, types2: better error msg when type inference fails in a call
In Checker.infer, report an error through an (incoming) *error_
so that the error can be reported as desired where infer is called.
Checker.infer is now a pure function.
Fixes #60543.
At call sites of Checker.infer, pass in an *error_ and use it to
report inference errors, together with additional information as
desired.
Fixes #60542.
In go/types, in error_.errorf, pass in a positioner rather than
a token.Pos. Also, introduce noposn, the positioner equivalent
for nopos. Adjust call sites as needed.
Change-Id: I462a7899a77a8bee2a21ba88299df237d74e0672
Reviewed-on: https://go-review.googlesource.com/c/go/+/558035 Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
Cherry Mui [Wed, 24 Jan 2024 20:00:47 +0000 (15:00 -0500)]
Revert "archive/tar: add FileInfoNames interface"
This reverts CL 514235. Also reverts CL 518056 which is a followup
fix.
Reason for revert: Proposal #50102 defined an interface that is
too specific to UNIX-y systems and also didn't make much sense.
The proposal is un-accepted, and we'll revisit in Go 1.23.
Fixes (via backport) #65245.
Updates #50102.
Change-Id: I41ba0ee286c1d893e6564a337e5d76418d19435d
Reviewed-on: https://go-review.googlesource.com/c/go/+/558295 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Bryan C. Mills [Tue, 23 Jan 2024 22:08:50 +0000 (17:08 -0500)]
net: ignore Dial errors in TestAcceptTimeout
Also use DialContext instead of just Dial so that we can ensure
the call returns before we close the listener.
The Dial in this test is intended to complete before the call to
Accept, but there is no synchronization to ensure that and sometimes
it doesn't happen. That's ok and mostly immaterial to the test, but it
does mean we need to ignore Dial errors (which can happen when the
listener is closed), and we need to be a little more careful about not
dialing a port that may have already been reused by some other test.
Jonathan Amsterdam [Mon, 22 Jan 2024 18:20:07 +0000 (13:20 -0500)]
doc/next: initial contents
Initialize the doc/next directory for the next release by copying the
contents of doc/initial into it.
Also, rewrite doc/README.md to add release instructions and to separate
information for developers from information for the release team.
Change-Id: Ie1e5c2ddae7a8d301e9b2f8a68925519648aa84d
Reviewed-on: https://go-review.googlesource.com/c/go/+/557535
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: Jonathan Amsterdam <jba@google.com>
Mauri de Souza Meneguzzo [Tue, 28 Nov 2023 18:42:43 +0000 (18:42 +0000)]
runtime: short path for equal pointers in arm64 memequal
If memequal is invoked with the same pointers as arguments it ends up
comparing the whole memory contents, instead of just comparing the pointers.
This effectively makes an operation that could be O(1) into O(n). All the
other architectures already have this optimization in place. For
instance, arm64 also have it, in memequal_varlen.
Such optimization is very specific, one case that it will probably benefit is
programs that rely heavily on interning of strings.
Mark Ryan [Tue, 7 Nov 2023 09:09:49 +0000 (10:09 +0100)]
cmd/go: add GORISCV64 environment variable
The variable represents the RISC-V user-mode application profile for
which to compile. Valid values are rva20u64 (the default) and
rva22u64.
Setting GORISCV64=rva20u64 defines the riscv64.rva20u64 build tag,
sets the internal variable buildcfg.GORISCV64 to 20 and defines the
macro GORISCV64_rva20u64 for use in assembly language code.
Setting GORISCV64=rva22u64 defines the riscv64.rva20u64 and
riscv64.rva22u64 build tags, sets the internal variable
buildcfg.GORISCV64 to 22 and defines the macro GORISCV64_rva22u64
for use in assembly language code.
This patch only provides a mechanism for the compiler and hand-coded
assembly language functions to take advantage of the RISC-V
extensions mandated by the application profiles. Further patches
will be required to get the compiler/assembler and assembly language
functions to actually generate and use these extensions.
Fixes #61476
Change-Id: I9195ae6ee71703cd2112160e89157ab63b8391af
Reviewed-on: https://go-review.googlesource.com/c/go/+/541135 Reviewed-by: M Zhuo <mengzhuo1203@gmail.com> Reviewed-by: Joel Sing <joel@sing.id.au>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Wang Yaduo <wangyaduo@linux.alibaba.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: M Zhuo <mengzhuo1203@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Russ Cox [Tue, 12 Dec 2023 17:53:32 +0000 (12:53 -0500)]
net: move cgo-using darwin test to separate package
It is a goal / requirement that nothing in the standard library
on darwin require cgo, and this test-only file makes net use
cgo on darwin. Move it elsewhere.
Change-Id: I6c11a8391d3913f73ce0098ba63b29adf5864f93
Reviewed-on: https://go-review.googlesource.com/c/go/+/549255 Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Bryan C. Mills [Mon, 11 Dec 2023 21:45:04 +0000 (16:45 -0500)]
net: unskip and attempt to deflake TestAcceptTimeout
This test has been unconditionally skipped for over five years.
It may be that whatever was causing it to flake has been fixed.
And if it hasn't been fixed, it isn't providing any value.
Let's unskip it for the Go 1.23 development cycle and see what happens.
Let's also use a separate listener for each test case, so that a
leaked Dial goroutine from one case won't interfere with the other.
Fixes #17948 (maybe).
Change-Id: I239f22ca5d5a44388b9aa0ed4d81e451c6342617
Reviewed-on: https://go-review.googlesource.com/c/go/+/548940
Commit-Queue: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
qiulaidongfeng [Tue, 23 Jan 2024 00:42:58 +0000 (00:42 +0000)]
reflect: delete TODO pass safe to packEface don't need to copy if safe==true
valueInterface not copy result in the follow incorrect behavior
w1. x := ValueOf(&v).Elem()
r1. iface := Value.Interface()
w2. x.Set() or x.SetT()
The write operation of W2 will be observed by the read operation of r1,
but the existing behavior is not.
The valueInterface in deepValueEqual can, in theory, pass safe==true to not copy the object,
but there is no benchmark to indicate that the memory allocation has changed,
maybe we don't actually need safe==true here.
Change-Id: I55c423fd50adac8822a7fdbfe67af89ee223eace
GitHub-Last-Rev: 4a6386709817f3ea6055711dd39d2694d58b3043
GitHub-Pull-Request: golang/go#64618
Reviewed-on: https://go-review.googlesource.com/c/go/+/548436
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@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Bryan C. Mills [Mon, 22 Jan 2024 23:02:38 +0000 (18:02 -0500)]
net: report timeouts more aggressively in Accept in the fake implementation
This ensures that if the listener has already timed out when Accept
is called, Accept always returns an error instead of instantaneously
accepting a connection that was already pending.
For #17948.
Change-Id: Iabef7121590df3dcc2fe428429d7c2bc2bcb6cd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/557438
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Damien Neil <dneil@google.com>
qmuntal [Fri, 19 Jan 2024 13:14:17 +0000 (14:14 +0100)]
runtime,internal/poll: move websocket handling out of the runtime on Windows
On Windows, the netpoll is currently coupled with the websocket usage
in the internal/poll package.
This CL moves the websocket handling out of the runtime and puts it into
the internal/poll package, which already contains most of the async I/O
logic for websockets.
This is a good refactor per se, as the Go runtime shouldn't know about
websockets. In addition, it will make it easier (in a future CL) to only
load ws2_32.dll when the Go program actually uses websockets.
Change-Id: Ic820872cf9bdbbf092505ed7f7504edb6687735e
Reviewed-on: https://go-review.googlesource.com/c/go/+/556936
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Olivier Mengué [Mon, 15 Jan 2024 23:32:40 +0000 (00:32 +0100)]
hash/crc32: fix codegen to align with manual changes
Update gen_const_ppc64le.go to match the manual changes applied in
CL 478976.
Change-Id: I79a0d014a2a151750f898517b2771b312f3437bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/555996 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>
Auto-Submit: Michael Pratt <mpratt@google.com>
Jorropo [Wed, 10 Jan 2024 06:31:57 +0000 (07:31 +0100)]
cmd/compile: improve integer comparisons with numeric bounds
This do:
- Fold always false or always true comparisons for ints and uint.
- Reduce < and <= where the true set is only one value to == with such value.
Change-Id: Ie9e3f70efd1845bef62db56543f051a50ad2532e
Reviewed-on: https://go-review.googlesource.com/c/go/+/555135
Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Change-Id: I92629a106b75b0526e9f2a8fe3cc4a6f7fc63c8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/518631
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: M Zhuo <mzh@golangcn.org> Reviewed-by: Wang Yaduo <wangyaduo@linux.alibaba.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Mark Ryan <markdryan@rivosinc.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Michael Anthony Knyszek [Mon, 22 Jan 2024 16:34:41 +0000 (16:34 +0000)]
runtime: use the correct M ID for syscalling goroutines in traces
Earlier in the development of the new tracer, m.id was used as a the
canonical ID for threads. Later, we switched to m.procid because it
matches the underlying OS resource. However, in that switch, we missed a
spot.
The tracer catches and emits statuses for goroutines that have remained
in either waiting or syscall across a whole generation, and emits a
thread ID for the latter set. The ID being used here, however, was m.id
instead of m.procid, like the rest of the tracer.
This CL also adds a regression test. In order to make the regression
test actually catch the failure, we also have to make the parser a
little less lenient about GoStatus events with GoSyscall: if this isn't
the first generation, then we should've seen the goroutine bound to an
M already when its status is getting emitted for its context. If we emit
the wrong ID, then we'll catch the issue when we emit the right ID when
the goroutine exits the syscall.
Fixes #65196.
Change-Id: I78b64fbea65308de5e1291c478a082a732a8bf9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/557456 Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Jin Lin [Wed, 20 Sep 2023 19:22:26 +0000 (12:22 -0700)]
cmd/preprofile: Add preprocess tool to pre-parse the profile file.
The pgo compilation time is very long if the profile file is large.
We added a preprocess tool to pre-parse profile file in order to
expedite the compile time.
Change-Id: I6f50bbd01f242448e2463607a9b63483c6ca9a12
Reviewed-on: https://go-review.googlesource.com/c/go/+/529738 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>
Bryan C. Mills [Mon, 22 Jan 2024 18:54:56 +0000 (13:54 -0500)]
net: delete TestListenCloseListen
In CL 557177, I attempted to fix a logical race in this test (#65175).
However, I introduced a data race in the process (#65209).
The race was reported on the windows-amd64-race builder. When I tried
to reproduce it on linux/amd64, I added a time.Sleep in the Accept
loop. However, that Sleep causes the test to fail outright with
EADDRINUSE, which suggests that my earlier guess about the open Conn
preventing reuse of the port was, in fact, incorrect.
On some platforms we could instead use SO_REUSEPORT and avoid closing
the first Listener entirely, but that wouldn't be even remotely in the
spirit of the original test.
Since I don't see a way to preserve the test in a way that is not
inherently flaky / racy, I suggest that we just delete it. It was
originally added as a regression test for a bug in the nacl port,
which no longer exists anyway. (Some of that code may live on in the
wasm port, but it doesn't seem worth maintaining a flaky
port-independent test to maintain a regression test for a bug specific
to secondary platforms.)
Roland Shoemaker [Wed, 10 Jan 2024 19:02:14 +0000 (11:02 -0800)]
net/mail: properly handle special characters in phrase and obs-phrase
Fixes a couple of misalignments with RFC 5322 which introduce
significant diffs between (mostly) conformant parsers.
This change reverts the changes made in CL50911, which allowed certain
special RFC 5322 characters to appear unquoted in the "phrase" syntax.
It is unclear why this change was made in the first place, and created
a divergence from comformant parsers. In particular this resulted in
treating comments in display names incorrectly.
Additionally properly handle trailing malformed comments in the group
syntax.
Fixes #65083
Change-Id: I00dddc044c6ae3381154e43236632604c390f672
Reviewed-on: https://go-review.googlesource.com/c/go/+/555596 Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Austin Clements [Wed, 3 Jan 2024 15:41:09 +0000 (10:41 -0500)]
runtime: simplify freedefer logic
Currently, freedefer's API forces a subtle and fragile situation. It
requires that the caller unlink the _defer from the G list, but
freedefer itself is responsible for zeroing some _defer fields. In the
window between these two steps, we have to prevent stack growth
because stack growth walks the defer list (which no longer contains
the unlinked defer) to adjust pointers, and would thus leave an
unadjusted and potentially invalid pointer behind in the _defer before
freedefer zeroes it.
This setup puts part of this subtle responsibility on the caller and
also means freedefer must be nosplit, which forces other shenanigans
to avoid nosplit overflows.
We can simplify all of this by replacing freedefer with a new popDefer
function that's responsible for both unlinking and zeroing the _defer,
in addition to freeing it.
Some history: prior to regabi, defer records contained their argument
frame, which deferreturn copied to the stack before freeing the defer
record (and subsequently running the defer). Since that argument frame
didn't have a valid stack map until we ran the deferred function, the
non-preemptible window was much larger and more difficult to isolate.
Now we use normal closure calls to capture defer state and call the
defer, so the non-preemptible window is narrowed to just the unlinking
step.
Change-Id: I7cf95ba18e1e2e7d73f616b9ed9fb38f5e725d72
Reviewed-on: https://go-review.googlesource.com/c/go/+/553696 Reviewed-by: Matthew Dempsky <mdempsky@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>
Auto-Submit: Austin Clements <austin@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>