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

log: fix a deadlock caused by conflicting lock order #8

Closed
wants to merge 1 commit into from

Conversation

BurtonQin
Copy link

This patch fixes a possible deadlock caused by conflicting lock order in src/log.rs:

clear_logs end_record
overlays.write()
appending.write()
appending.write()//deadlock!
overlays.write()//deadlock!

The fix is to lift the overlays.write() above appending.write() in end_record().

@arkpar
Copy link
Member

arkpar commented Jun 8, 2020

Thank you for detecting this. Even though clear_logs is never called in parallel with end_record this might change in the future. Proposed fix is suboptimal though. Calling to_file is expensive and the overlay lock should not be taken at this time.

I've fixed clear_log in 87abacb instead.

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