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

Tracing appender tests #678

Merged
merged 17 commits into from
May 4, 2020
Merged

Tracing appender tests #678

merged 17 commits into from
May 4, 2020

Conversation

zekisherif
Copy link
Contributor

Motivation

Adding tests for PR #673

tracing-appender/src/rolling.rs Outdated Show resolved Hide resolved
tracing-appender/src/non_blocking.rs Show resolved Hide resolved
tracing-appender/src/rolling.rs Outdated Show resolved Hide resolved
tracing-appender/src/non_blocking.rs Outdated Show resolved Hide resolved
@zekisherif
Copy link
Contributor Author

zekisherif commented Apr 17, 2020

Few additional notes:

Clippy doesn't catch the .bytes() warnings locally for me unfortunantely, so I have to rely on the clippy checker here.

I need to also find a way to make sure cargo fmt is run before any commit as I sometimes forget.

Edit: Realized that I needed to run cargo clippy --tests for it inform me of clippy warnings.

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.

I want to go over the multithreaded test in more detail, but I left some preliminary notes.

tracing-appender/src/rolling.rs Outdated Show resolved Hide resolved
tracing-appender/src/rolling.rs Outdated Show resolved Hide resolved
tracing-appender/src/rolling.rs Outdated Show resolved Hide resolved
tracing-appender/src/non_blocking.rs Outdated Show resolved Hide resolved
tracing-appender/src/non_blocking.rs Show resolved Hide resolved
tracing-appender/src/non_blocking.rs Show resolved Hide resolved
tracing-appender/src/non_blocking.rs Outdated Show resolved Hide resolved
tracing-appender/src/non_blocking.rs Outdated Show resolved Hide resolved
tracing-appender/src/non_blocking.rs Outdated Show resolved Hide resolved
@zekisherif
Copy link
Contributor Author

zekisherif commented Apr 20, 2020

Looks like one of the tests hangs, logs_dropped_if_lossy will look to see what is causing that to happen.

Edit:
Looks like for the case when non blocking is lossy, I must drop non_blocking at the end of the test otherwise it wil hang some times.

tracing-appender/src/non_blocking.rs Outdated Show resolved Hide resolved
@hawkw
Copy link
Member

hawkw commented Apr 28, 2020

CI failures look like crates.io was returning 500s for a bit; I restarted them.

@zekisherif zekisherif requested a review from a team as a code owner April 30, 2020 17:45
@zekisherif
Copy link
Contributor Author

Rebased

Comment on lines 139 to 144

#[derive(Debug)]
pub(crate) enum Msg {
Line(Vec<u8>),
Shutdown,
}
Copy link
Member

@davidbarsky davidbarsky Apr 30, 2020

Choose a reason for hiding this comment

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

I forgot about this: dropping a sender is equivalent to a shutdown notice.

(I'm not treating this as public, as this is not in the public API and we can tidy up later.)

@hawkw
Copy link
Member

hawkw commented Apr 30, 2020

I'd really prefer it if the change that fixes the bug could land in a separate PR from the change that adds tests, so that the Git history is clearer — @zekisherif, would you mind moving that into a separate branch?

@zekisherif
Copy link
Contributor Author

I'd really prefer it if the change that fixes the bug could land in a separate PR from the change that adds tests, so that the Git history is clearer — @zekisherif, would you mind moving that into a separate branch?

Sure I can do that.

@zekisherif
Copy link
Contributor Author

Once this is merged in, I'll raise a PR for the bug fix

@hawkw
Copy link
Member

hawkw commented Apr 30, 2020

Once this is merged in, I'll raise a PR for the bug fix

I think we should merge the bugfix first to avoid having a broken build on master.

hawkw pushed a commit that referenced this pull request 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.

Co-authored-by: Zeki Sherif <zekshi@amazon.com>
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.

A couple nits, but this looks good.

tracing-appender/src/non_blocking.rs Outdated Show resolved Hide resolved
tracing-appender/src/non_blocking.rs Outdated Show resolved Hide resolved
@hawkw hawkw merged commit 750b031 into tokio-rs:master May 4, 2020
hawkw added a commit that referenced this pull request May 5, 2020
Following the release process for
https://github.com/tokio-rs/tracing/blob/master/CONTRIBUTING.md and
these changes are the only things left to commit before release.

I'd like to hopefully get this released today so we can start using this
crate internally.

Note: I need to get PR #703 and PR #678 merged before release.

Co-authored-by: Zeki Sherif <zekshi@amazon.com>
Co-authored-by: Eliza Weisman <eliza@buoyant.io>
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