-
Notifications
You must be signed in to change notification settings - Fork 544
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
query-frontend: cancel stream to scheduler when streaming failed #3302
query-frontend: cancel stream to scheduler when streaming failed #3302
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I have one comment, and a proposal for a test:
https://gist.github.com/pstibrany/7a4384aee0b8389475ca7dd34af58410#file-frontend_test-go-L437
thanks for the review and the test @pstibrany. I think I've incorporated the changes you requested and the test too. Can you take another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you!
Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> Co-authored-by: Peter Štibraný <pstibrany@gmail.com>
6e8b971
to
8076883
Compare
Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> Co-authored-by: Peter Štibraný <pstibrany@gmail.com>
Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> Co-authored-by: Peter Štibraný <pstibrany@gmail.com>
8076883
to
362838c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! I just let a nit 🙏
pkg/frontend/v2/frontend_test.go
Outdated
require.Equal(t, 1, checkStreamGoroutines()) | ||
} | ||
|
||
const createdBy = "created by google.golang.org/grpc.newClientStreamWithParams" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] Move this const inside checkStreamGoroutines()
.
Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
…fana#3302) * query-frontend: cancel stream to scheduler when streaming failed Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> Co-authored-by: Peter Štibraný <pstibrany@gmail.com> * Add changelog entry Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> Co-authored-by: Peter Štibraný <pstibrany@gmail.com> * Add test for proper stream cleanup Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> Co-authored-by: Peter Štibraný <pstibrany@gmail.com> * Simplify checkStreamGoroutines Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> Co-authored-by: Peter Štibraný <pstibrany@gmail.com>
…fana#3302) * query-frontend: cancel stream to scheduler when streaming failed Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> Co-authored-by: Peter Štibraný <pstibrany@gmail.com> * Add changelog entry Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> Co-authored-by: Peter Štibraný <pstibrany@gmail.com> * Add test for proper stream cleanup Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> Co-authored-by: Peter Štibraný <pstibrany@gmail.com> * Simplify checkStreamGoroutines Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com> Co-authored-by: Peter Štibraný <pstibrany@gmail.com>
Signed-off-by: Dimitar Dimitrov dimitar.dimitrov@grafana.com
What this PR does
discovered by @pstibrany:
makes sure that the query-frontend properly terminates gRPC streams to the query-scheduler after the scheduler closes the connections on them
without this there was a goroutine and memory leak. In the attached screenshot you can see on the left side of each graph GEM running without this fix and on the right side of each graph GEM with this fix.
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]