Skip to content

internal/trace: event timestamps change between Go versions #73558

Closed
@rhysh

Description

@rhysh

Go version

go version devel go1.25-1e756dc5f7 Tue Apr 29 07:38:24 2025 -0700 darwin/arm64

Output of go env in your module/workspace:

AR='ar'
CC='clang'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='clang++'
GCCGO='gccgo'
GO111MODULE=''
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/Users/rhysh/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/rhysh/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/pw/d_qmtcrd3vs0890gvmrq8qx80000gn/T/go-build1656212783=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/Users/rhysh/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/rhysh/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/rhysh/sdk/go-bisect'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/rhysh/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/rhysh/sdk/go-bisect/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='devel go1.25-1e756dc5f7 Tue Apr 29 07:38:24 2025 -0700'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

A colleague and I used different Go versions' "go tool trace" to open the same execution trace, and attempted to communicate about specific events we were seeing in the HTML UI. We attempted to direct each other to interesting parts of the execution trace by referring to precise timestamps.

What did you see happen?

We couldn't find the event that the other was referring to. We discovered that the timestamp rendered the "go tool trace" HTML UI changed between Go 1.24 and tip.

With pre-1.25 tip, I see a "Sync" event that isn't present in Go 1.24's output. Previously the first timestamp in this particular trace (which the tool uses for the relative timestamps it calculates for display) was 1319851905344, but the new "Sync" event has a timestamp of 1319851891521. And sure enough, all of the timestamps in the HTML UI are off by 13823 nanoseconds.

$ go tool trace -d=parsed ./trace.out | head -n 3
M=-1 P=-1 G=-1 Sync Time=1319851891521
M=8 P=-1 G=-1 StateTransition Time=1319851905344 Resource=Proc(1) Reason="" ProcID=1 Undetermined->Running
M=8 P=1 G=-1 StateTransition Time=1319851905600 Resource=Goroutine(726965) Reason="" GoID=726965 Undetermined->Running

$ ~/sdk/go1.24/bin/go tool trace -d=parsed ./trace.out | head -n 3
M=8 P=-1 G=-1 StateTransition Time=1319851905344 Resource=Proc(1) Reason="" ProcID=1 Undetermined->Running
M=8 P=1 G=-1 StateTransition Time=1319851905600 Resource=Goroutine(726965) Reason="" GoID=726965 Undetermined->Running
M=8 P=1 G=726965 Metric Time=1319851908672 Name="/sched/gomaxprocs:threads" Value=Uint64(8)

I bisected to ca1cfea, which emits the "Sync" event (for good reason, of course).

What did you expect to see?

Execution trace tooling would be helped by having a stable identifier for each event. Previously when the execution trace parser stopped being deterministic across runs with the same tool version (in #68277, due to map iteration order), @mknyszek has said "this is an important property of the trace parser to maintain". This is a different case — of stability across Go versions. Overall, it's probably "unfortunate", and as long as we don't have many more breaks like this, everyone will eventually be on versions of the tools that have consistent behavior.

Are there any similar changes on the horizon, or do we expect the Sync event will keep being the timeline's zero point for versions at and beyond Go 1.25? Thanks.

CC @mknyszek @golang/runtime

Metadata

Metadata

Labels

BugReportIssues describing a possible bug in the Go implementation.NeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions