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

Prevent deadlocks with replicas #524

Merged
merged 2 commits into from
Dec 16, 2023

Conversation

hifi
Copy link
Collaborator

@hifi hifi commented Nov 15, 2023

Always close pipe reader when WriteWALSegment returns. If we don't, the writers can deadlock. We've had this happen when during shutdown replica Sync() gets called and it's being passed a canceled context.

Always use caller context for snapshotN as there is no guarantee the background context ever finishes. Haven't seen this causing problems in the wild but it has potential to lock up.

hifi added 2 commits December 16, 2023 11:50
Otherwise it isn't possible to gracefully cancel counting.
The pipe writer will deadlock if writing out the WAL segment fails
for any reason.
@hifi hifi force-pushed the for-upstream/deadlock-fixes branch from 5e9c94f to 2b4ec80 Compare December 16, 2023 09:51
@hifi hifi merged commit 7badf0e into benbjohnson:main Dec 16, 2023
3 checks passed
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.

1 participant