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 deadlock when shutting down mdbx flusher #14261

Merged
merged 3 commits into from
Mar 26, 2025
Merged

Conversation

antonis19
Copy link
Member

No description provided.

@antonis19 antonis19 changed the title Make quit channel blocking and use mutex to prevent deadlock Prevent deadlock when shutting down mdbx flusher Mar 23, 2025
@antonis19 antonis19 requested a review from AskAlexSharov March 24, 2025 22:21

func (flusher *PeriodicFlusher) Close() {
flusher.shutdown()
flusher.doneWg.Wait()
Copy link
Collaborator

Choose a reason for hiding this comment

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

WaitGroup - must guarantee that “nothing will happen after shutdown” or “shutdown will happen after all other things”.
Now “.Wait”.called after shutdown - doesn’t guarantee anything.

Copy link
Member Author

Choose a reason for hiding this comment

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

You are waiting for shutdown to complete. Essentially you are waiting for the for loop to exit.

@AskAlexSharov AskAlexSharov merged commit 9e8ecf2 into main Mar 26, 2025
13 checks passed
@AskAlexSharov AskAlexSharov deleted the flusher-quit-chan branch March 26, 2025 11:43
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.

2 participants