-
Notifications
You must be signed in to change notification settings - Fork 161
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
bug: LocalPool
swallowing logs in iroh-blobs
tests
#2589
Conversation
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/2589/docs/iroh/ Last updated: 2024-08-05T17:28:43Z |
@@ -568,6 +572,7 @@ mod tests { | |||
tokio::time::sleep(Duration::from_millis(100)).await; | |||
// drop x at the end. we will never get here when the future is | |||
// no longer polled, but drop should still be called | |||
tracing::debug!("Dropping {x:?}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dignifiedquire should this line still be caught in logging? It's not currently.
Still looking into this. FWIW the The problem with using a global subscriber is that all tests use the same subscriber and IIRC your tests output starts flowing into the wrong tests due to how test isolation and output capturing works. |
This preserves the tracing subscriber that is installed in the current thread when the LocalPool is created. It then installs it into every thread managed by the pool, ensuring that tracing output from the pool is preserved. Maybe this should be configurable, though since this is just an internal tool for us I think we're fine just always having this behaviour. Fixes #2589
Oops, I thought this was an issue and it's a PR... I replaced this in #2735 |
## Description This preserves the tracing subscriber that is installed in the current thread when the LocalPool is created. It then installs it into every thread managed by the pool, ensuring that tracing output from the pool is preserved. ## Breaking Changes Why is this even pub? But fine: `iroh_blobs::util::local_pool::LocalPool` will now install the tracing subscriber of the thread creating the pool, into each thread managed by the pool. Practically this should not break any code already managing their tracing subscribers either manually inside tasks or by setting a global subscriber before creating the pool. But if you really liked the behaviour of swallowing the logs on doing this it's a breaking change. ## Notes & open questions Maybe this should be configurable, though since this is just an internal tool for us I think we're fine just always having this behaviour. Fixes #2577 Replaces #2589 ## Change checklist - [x] Self-review. - [x] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [x] Tests if relevant. - [x] All breaking changes documented.
The other PR did get merged |
Description
While investigating the flaky CI failure of the
localpool::test_drop
test, I found an example ofLocalPool
eating logging.The logs inside the
test_drop
print, but any logs written inLocalPool::spawn_detached
are lost.run
cargo test --package iroh-blobs test_drop -- --nocapture
to view.I also had to change from using
tracing_subscriber::fmt::try_init()
toiroh_test::logging::setup()
in the test to get ANY logging to show.Related to #2577
Notes & open questions
Change checklist