1
0
mirror of https://github.com/golang/go synced 2024-11-13 17:10:21 -07:00

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/11100
Reviewed-by: Andrew Gerrand <adg@golang.org>
This commit is contained in:
Dmitry Vyukov 2015-06-14 22:58:54 +02:00
parent 9a8750b276
commit 202de394f2

View File

@ -322,10 +322,6 @@ func (ctx *traceContext) emit(e *ViewerEvent) {
} }
func (ctx *traceContext) time(ev *trace.Event) int64 { 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 // NOTE: trace viewer wants timestamps in microseconds and it does not
// handle fractional timestamps (rounds them). We give it timestamps // handle fractional timestamps (rounds them). We give it timestamps
// in nanoseconds to avoid rounding. See: // in nanoseconds to avoid rounding. See: