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

Appender: Use channel to signal shutdown of worker thread #701

Merged
merged 3 commits into from
Apr 30, 2020
Merged

Appender: Use channel to signal shutdown of worker thread #701

merged 3 commits into from
Apr 30, 2020

Conversation

zekisherif
Copy link
Contributor

@zekisherif zekisherif commented Apr 30, 2020

Motivation

Fixes a race condition which occurs on dropping of WorkerGuard. If the worker thread missed seeing the shutdown signal in time, it would end up blocking on trying to call recv() on the crossbeam channel and block indefinitely.

This bug was identified in #678

Solution

Signal that the worker should stop by sending a ShutDown message through the crossbeam channel.

@zekisherif zekisherif requested review from hawkw and a team as code owners April 30, 2020 18:42
tracing-appender/src/non_blocking.rs Outdated Show resolved Hide resolved
tracing-appender/src/worker.rs Show resolved Hide resolved
Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

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

lgtm

@hawkw hawkw merged commit f93ba2e into tokio-rs:master Apr 30, 2020
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