]> Cypherpunks repositories - gostls13.git/commitdiff
internal/trace: emit a Sync event even if the next generation is broken
authorMichael Anthony Knyszek <mknyszek@google.com>
Mon, 10 Feb 2025 20:10:22 +0000 (20:10 +0000)
committerGopher Robot <gobot@golang.org>
Mon, 10 Feb 2025 21:39:31 +0000 (13:39 -0800)
Since CL 644215 each Sync event now represents the coming generation,
with a final Sync event emitted even when there's nothing ahead. This
change however failed to emit a Sync event at the end of a completely
valid generation when the next generation was invalid, causing the
runtime test TestCrashWhileTracing to start failing.

Fix this by emitting a final Sync event even when the next generation is
broken. We hold onto the error in parsing the next generation and emit
it after that final Sync event.

(Should these "final" Sync events distinguish themselves in some way?)

Fixes #71615.

Change-Id: I1f8abee5abaa39e1219e6fa05e9f82f1478db4c9
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/648195
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/internal/trace/reader.go

index 81710c0125eda595770da019ad1d30764f72e1ed..75b88f7bac5fbc4c89430f4ac3bb6d0ad8d0b851 100644 (file)
@@ -152,12 +152,10 @@ func (r *Reader) ReadEvent() (e Event, err error) {
                        return syncEvent(nil, r.lastTs, r.syncs), nil
                }
                // Read the next generation.
-               var err error
-               r.gen, r.spill, err = readGeneration(r.r, r.spill)
+               r.gen, r.spill, r.spillErr = readGeneration(r.r, r.spill)
                if r.gen == nil {
-                       return Event{}, err
+                       return syncEvent(nil, r.lastTs, r.syncs), nil
                }
-               r.spillErr = err
 
                // Reset CPU samples cursor.
                r.cpuSamples = r.gen.cpuSamples