-
Notifications
You must be signed in to change notification settings - Fork 11
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
Index out-of-range panic in examples #4
Comments
The error appears to be related to handling
Here's what appears to be happening:
I added some prints:
And it outputs this:
I guess the thought behind this code is that the To be honest I'm not an expert about how Go slices work behind the scenes, but I'm not sure if this is actually needed? If I delete the second for-loop:
it fixes the panic, but I can see that the len and cap of the slice gets bigger each time I call the API, so clearly I'm not cleaning up subscriptions properly. So that for-loop must have some imporatance.
|
I can see in the fork by @andreas-tiket there is a fix for this |
I have found a way to reliably produce an index out-of-range in the example.
go run extended_example.go
Send two GET requests to the same renewable resorce within a few seconds (so the second request has to wait for the promise of the first request):
GET localhost:8080/report/renewable/123
(wait 2 seconds)
GET localhost:8080/report/renewable/123
Then one of the requests fails with:
The same problem can also be reproduced with the
/ext/stemmer
and/report/oh-no/
routes. I can't reproduce it with the/query/simple
route though.If I were to guess, this only affects
GetResourceRenewable
andGetResourceExternal
, but notGetResource
.The text was updated successfully, but these errors were encountered: