-
Notifications
You must be signed in to change notification settings - Fork 14
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
fix: avoid scheduling an instance refresh if the context is done #491
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use -- conventional-commit-lint bot |
6e14131
to
6b5feee
Compare
Nice find @jomaresch. If you can sign the CLA, we're happy to look at this. Otherwise, we can fix it in a separate PR. |
@enocom I already signed the CLA. The failing check, which indicated the missing CLA, are also gone. |
Looking at this closely, I see there's a deeper problem. Yes, we need to move the context check up as you've done here, but we also need to stop the timers in Would you be interested in landing this change, or prefer that I take it over? See #493 |
8429586
to
a21c87f
Compare
9f0d8be
to
acf8f83
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.
Added the timer change and moved the context check up to the top of the function.
Thanks for sending this! We'll get it into the next release.
acf8f83
to
bf22bf7
Compare
Hello,
I discovered that closing the instance will cause an infinite loop in the
scheduleRefresh
function.Closing the Instance will cancel the context, which causes an error in the Limiter:
alloydb-go-connector/internal/alloydb/instance.go
Lines 263 to 267 in ff5ca35
Every error here will trigger a new refresh with 0 sec delay:
alloydb-go-connector/internal/alloydb/instance.go
Lines 283 to 286 in ff5ca35
This refresh will also fail because of the canceled context.
The result is high resource consumption, once the instance has been closed, because of this infinite loop.
As a fix I propose to check the context earlier and don't schedule a new refresh once the context is closed.
I didn't write a test, because i did't find a way to properly test the absence of the loop. But I'm open for suggestions.