throttle: negative running counter
jirenius opened this issue · 2 comments
jirenius commented
Issue
On system reset events, Resgate may crash with the error:
throttle: negative running counter
This may happen when using the resetThrottle
option set to a value > 0.
Stack trace
panic: throttle: negative running counter
goroutine 1779 [running]:
github.com/resgateio/resgate/server/rescache.(*Throttle).Done(0xc0003a6b00)
/src/resgate/server/rescache/throttle.go:49 +0x13d
github.com/resgateio/resgate/server.(*Subscription).handleReaccess(0xc0003a6b00, 0xc00040c150)
/src/resgate/server/subscription.go:742 +0x117
github.com/resgateio/resgate/server.(*Subscription).reaccess(0xc00051df98, 0x1)
/src/resgate/server/subscription.go:824 +0x4a
github.com/resgateio/resgate/server.(*Subscription).Reaccess.func1()
/src/resgate/server/subscription.go:809 +0x25
github.com/resgateio/resgate/server.(*wsConn).outputWorker(0xc0001742c0)
/src/resgate/server/wsConn.go:587 +0x1cf
created by github.com/resgateio/resgate/server.(*Service).newWSConn
/src/resgate/server/wsConn.go:69 +0x407
jirenius commented
This happened when a query resource with more than one cached query matches a reset pattern (both for resources
and for access
). The throttle counts up only once for each matching resource, and down for each query of that resource.