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

Avoid a race-condition leading to crash in Log::clean_logs #161

Merged
merged 1 commit into from
Nov 10, 2022

Conversation

Tpt
Copy link
Contributor

@Tpt Tpt commented Oct 31, 2022

If Log.cleanup_queue is partially drained between the computation of the number of logs to clean (the "count" parameter) and the actual call to "drain", the drain method was panicking.

The changed code only drains at most the number of elements of the queue, avoiding the panic risk.

Found using Loom

If Log.cleanup_queue is partially drained between the computation of the number of logs to clean (the "count" parameter) and the actual call to "drain", the drain method was panicking.

The changed code only drains at most the number of elements of the queue, avoiding the panic risk.

Found using Loom
@Tpt Tpt requested review from arkpar and cheme November 10, 2022 11:51
Copy link
Collaborator

@cheme cheme left a comment

Choose a reason for hiding this comment

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

lgtm

@cheme cheme merged commit c8bed2b into paritytech:master Nov 10, 2022
@Tpt Tpt deleted the safe-clean branch November 11, 2022 09:49
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.

3 participants