-
Notifications
You must be signed in to change notification settings - Fork 630
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
CASSGO-41 Fix deadlock in refresh debouncer stop #1767
base: trunk
Are you sure you want to change the base?
Conversation
// https://github.com/gocql/gocql/issues/1752 | ||
func TestRefreshDebouncer_DeadlockOnStop(t *testing.T) { | ||
// there's no way to guarantee this bug manifests because it depends on which `case` is picked from the `select` | ||
// with 4 iterations of this test the deadlock would be hit pretty consistently |
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.
Does this comment indicate that you were reliably reproducing it without the fix in place or is it just speculating that 4 should be enough to hit it?
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.
I was reliably reproducing it with 4 without the fix in place
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.
Not sure if my review helps get this merged, but I checked out the branch and verified that the test reliably reproduces the bug without the fix and passes with the fix. Thanks!
refreshFn func() error | ||
quitCtxFn context.CancelFunc |
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.
I would say this is a bit of an abuse of contexts. Instead I would keep the old behavior but just change a small thing. Add another chan struct{}
here called done
that is defer close(done)
in flusher
. Then in stop()
keep what was there but don't write to quit
(I'm not really sure what the purpose of that was anyways) and just close it. Then do <-done
to wait for flusher
to stop.
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.
I think what was there was pretty close just need to make some small changes.
fix #1752