Commit 202de394 authored by Dmitry Vyukov's avatar Dmitry Vyukov

cmd/trace: fix panic in goroutine profile

In generateTrace we check that event timestamp is within the interesting range.
Then later in traceContext.time we double check event time.
However, for some events (e.g. emitSlice) we convert time of ev.Link (slice end) rather than ev itself (slice begin).
Slice end can be outside of the interesting time range, and so traceContext.time crashes.
Remove the check in traceContext.time, check in generateTrace loop is sufficient.

Change-Id: If94e93b5653c5816c0a8dcdd920f15df97616835
Reviewed-on: https://go-review.googlesource.com/11100Reviewed-by: 's avatarAndrew Gerrand <adg@golang.org>
parent 9a8750b2
......@@ -322,10 +322,6 @@ func (ctx *traceContext) emit(e *ViewerEvent) {
}
func (ctx *traceContext) time(ev *trace.Event) int64 {
if ev.Ts < ctx.startTime || ev.Ts > ctx.endTime {
fmt.Printf("ts=%v startTime=%v endTime=%v\n", ev.Ts, ctx.startTime, ctx.endTime)
panic("timestamp is outside of trace range")
}
// NOTE: trace viewer wants timestamps in microseconds and it does not
// handle fractional timestamps (rounds them). We give it timestamps
// in nanoseconds to avoid rounding. See:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment