Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TO GET /caches/stats panic converting string to uint64 #5565

Closed
rawlinp opened this issue Feb 23, 2021 · 1 comment · Fixed by #5600
Closed

TO GET /caches/stats panic converting string to uint64 #5565

rawlinp opened this issue Feb 23, 2021 · 1 comment · Fixed by #5600
Assignees
Labels
bug something isn't working as intended Traffic Ops related to Traffic Ops

Comments

@rawlinp
Copy link
Contributor

rawlinp commented Feb 23, 2021

I'm submitting a ...

  • bug report

Traffic Control components affected ...

  • Traffic Ops

Current behavior:

TO panics in the GET /api/x/caches/stats route doing an unchecked type assertion:

ERROR: api.go:209: 2021-02-23T13:28:59.128183143Z: 96.118.252.81:34068 panic: (err: interface conversion: interface {} is string, not uint64) stacktrace:
goroutine 47852 [running]:
github.com/apache/trafficcontrol/lib/go-util.Stacktrace(0xc00159f658, 0xe324e0, 0xc0284781e0)
	/tmp/go/src/github.com/apache/trafficcontrol/lib/go-util/util.go:32 +0x9f
github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware.WrapPanicRecover.func1.1(0x107ebc0, 0xc020ab7230, 0xc00018ae00)
	/tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware/wrappers.go:152 +0x58
panic(0xe324e0, 0xc0284781e0)
	/usr/local/go/src/runtime/panic.go:969 +0x1b9
github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/cachesstats.addStats(0xc0066ac000, 0xa7e, 0xcaa, 0xc00ce7a190, 0x4b, 0xc0018c0400, 0x1c, 0xc020ab7a10, 0xc0018c0400, 0x1c, ...)
	/tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/cachesstats/cachesstats.go:149 +0x353
github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/cachesstats.getCachesStats(0xc0063ec400, 0x0, 0x0, 0x0, 0x0, 0x0)
	/tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/cachesstats/cachesstats.go:94 +0xda5
github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/cachesstats.Get(0x107ebc0, 0xc020ab7230, 0xc00018ae00)
	/tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/cachesstats/cachesstats.go:45 +0x12e
github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware.AuthBase.GetWrapper.func1.1(0x107ebc0, 0xc020ab7230, 0xc00018ae00)
	/tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware/wrappers.go:107 +0x282
github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware.WrapPanicRecover.func1(0x107ebc0, 0xc020ab7230, 0xc00018ae00)
	/tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware/wrappers.go:156 +0x79
github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware.WrapHeaders.func1(0x1081c40, 0xc0052927e0, 0xc00018ae00)
	/tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware/wrappers.go:136 +0x64f
net/http.HandlerFunc.ServeHTTP(0xc00007e7a0, 0x1081c40, 0xc0052927e0, 0xc00018ae00)
	/usr/local/go/src/net/http/server.go:2042 +0x44
net/http.(*timeoutHandler).ServeHTTP.func1(0xc0052929c0, 0xc00f516600, 0xc0052927e0, 0xc00018ae00, 0xc00435ac00)
	/usr/local/go/src/net/http/server.go:3272 +0x7f
created by net/http.(*timeoutHandler).ServeHTTP
	/usr/local/go/src/net/http/server.go:3266 +0x22e

Expected behavior:

TO should properly convert the string into a uint64 rather than doing an unchecked type assertion.

Minimal reproduction of the problem with instructions:

Request GET /api/3.0/caches/stats, observe the above 500 internal server error and stacktrace in the TO logs.

@rawlinp rawlinp added bug something isn't working as intended Traffic Ops related to Traffic Ops labels Feb 23, 2021
@srijeet0406
Copy link
Contributor

@rawlinp I can take this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something isn't working as intended Traffic Ops related to Traffic Ops
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants