Skip to content
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: do not migrate during connection close #2570

Merged
merged 3 commits into from
Feb 12, 2024
Merged

fix: do not migrate during connection close #2570

merged 3 commits into from
Feb 12, 2024

Conversation

romange
Copy link
Collaborator

@romange romange commented Feb 11, 2024

Fixes #2569
Before the change we had a corner case where Dragonfly would call OnPreMigrateThread but would not call CancelOnErrorCb because OnBreakCb has already been called (it resets break_cb_engaged_)

On the other hand in OnPostMigrateThread we called RegisterOnErrorCb if breaker_cb_ which resulted in double registration. This change simplifies the logic by removing break_cb_engaged_ flag since CancelOnErrorCb is safe to call if nothing is registered. Moreover, we now skip Migrate flow if a socket is being closed.

@romange romange requested a review from chakaz February 11, 2024 09:52
kostasrim
kostasrim previously approved these changes Feb 11, 2024
chakaz
chakaz previously approved these changes Feb 11, 2024
@romange
Copy link
Collaborator Author

romange commented Feb 11, 2024

@chakaz with help of @adiholden I added the test that sporadically reproduced the problem for me

adiholden
adiholden previously approved these changes Feb 11, 2024
chakaz
chakaz previously approved these changes Feb 11, 2024
tests/dragonfly/eval_test.py Outdated Show resolved Hide resolved
chakaz
chakaz previously approved these changes Feb 11, 2024
Copy link
Collaborator

@chakaz chakaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice :)

Fixes #2569
Before the change we had a corner case where Dragonfly would call
OnPreMigrateThread but would not call CancelOnErrorCb because OnBreakCb has already been called
(it resets break_cb_engaged_)

On the other hand in OnPostMigrateThread we called RegisterOnErrorCb if breaker_cb_ which resulted in double registration.
This change simplifies the logic by removing break_cb_engaged_ flag since CancelOnErrorCb is safe to call if nothing is registered.
Moreover, we now skip Migrate flow if a socket is being closed.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
@romange romange merged commit 4000adf into main Feb 12, 2024
10 checks passed
@romange romange deleted the Pr1 branch February 12, 2024 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

crash during connection migration
4 participants