mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/trace: handle invalid goid para in /trace
Change-Id: I1cb7c8b70a5ae16386f6abb577c23d821f7ff7f0 Reviewed-on: https://go-review.googlesource.com/112197 Reviewed-by: Peter Weinberger <pjw@google.com> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
This commit is contained in:
parent
9eface7077
commit
43b18f4241
1 changed files with 8 additions and 4 deletions
|
|
@ -185,11 +185,15 @@ func httpJsonTrace(w http.ResponseWriter, r *http.Request) {
|
||||||
// If goid argument is present, we are rendering a trace for this particular goroutine.
|
// If goid argument is present, we are rendering a trace for this particular goroutine.
|
||||||
goid, err := strconv.ParseUint(goids, 10, 64)
|
goid, err := strconv.ParseUint(goids, 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("failed to parse goid parameter '%v': %v", goids, err)
|
log.Printf("failed to parse goid parameter %q: %v", goids, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
analyzeGoroutines(res.Events)
|
analyzeGoroutines(res.Events)
|
||||||
g := gs[goid]
|
g, ok := gs[goid]
|
||||||
|
if !ok {
|
||||||
|
log.Printf("failed to find goroutine %d", goid)
|
||||||
|
return
|
||||||
|
}
|
||||||
params.mode = modeGoroutineOriented
|
params.mode = modeGoroutineOriented
|
||||||
params.startTime = g.StartTime
|
params.startTime = g.StartTime
|
||||||
if g.EndTime != 0 {
|
if g.EndTime != 0 {
|
||||||
|
|
@ -249,12 +253,12 @@ func httpJsonTrace(w http.ResponseWriter, r *http.Request) {
|
||||||
// If start/end arguments are present, we are rendering a range of the trace.
|
// If start/end arguments are present, we are rendering a range of the trace.
|
||||||
start, err = strconv.ParseInt(startStr, 10, 64)
|
start, err = strconv.ParseInt(startStr, 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("failed to parse start parameter '%v': %v", startStr, err)
|
log.Printf("failed to parse start parameter %q: %v", startStr, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
end, err = strconv.ParseInt(endStr, 10, 64)
|
end, err = strconv.ParseInt(endStr, 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("failed to parse end parameter '%v': %v", endStr, err)
|
log.Printf("failed to parse end parameter %q: %v", endStr, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue