From: Dmitry Vyukov Date: Sun, 14 Jun 2015 20:58:54 +0000 (+0200) Subject: cmd/trace: fix panic in goroutine profile X-Git-Tag: go1.5beta1~263 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=202de394f2f7864eb871d65b733479115cfabc39;p=gostls13.git 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 --- diff --git a/src/cmd/trace/trace.go b/src/cmd/trace/trace.go index 6b5cfe30e5..29fae015ed 100644 --- a/src/cmd/trace/trace.go +++ b/src/cmd/trace/trace.go @@ -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: