-
Notifications
You must be signed in to change notification settings - Fork 389
Add tracing_chrome under "tracing" feature #4406
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
base: master
Are you sure you want to change the base?
Conversation
The file was taken unmodified from the following link, except for file attributes at the top: https://github.com/thoren-d/tracing-chrome/blob/7e2625ab4aeeef2f0ef9bde9d6258dd181c04472/src/lib.rs Depending on the tracing-chrome crate from crates.io is unfortunately not possible since it depends on `tracing_core` which conflicts with rustc_private's `tracing_core` (meaning it would not be possible to use the [ChromeLayer] in a context that expects a [Layer] from from rustc_private's `tracing_core` version)
The tracing_chrome Layer has a connected Guard that needs to be dropped before exiting the process, or else data may not be flushed to the tracing file. This required making a few changes to main() to ensure std::process::exit() is not called without making sure to first drop the guard.
I am not sure why tests fail, when I tried locally they failed even on the latest commit on |
I am on May I know what os are you currently using? And is the failure the same as the one in the CI? |
@tiif On my PC the tests that fail run into errors like "error: unsupported operation: extern static
I am also on |
I suspect the CI failure might be triggered by the change in this PR, as there were successful CI runs after this one in https://github.com/rust-lang/miri/actions. (I haven't read the code closely, so this is just a guess :) About the unsupported error, I think maybe the toolchain is outdated. You can try to follow the steps here https://github.com/rust-lang/miri/blob/master/CONTRIBUTING.md#preparing-the-build-environment to update it if you haven't done so recently. If the problem persists, feel free to ask for help in zulip. |
Machine::TRACING_ENABLED
totrue
tracing_chrome
crate by copy-pasting this ~600 line file.tracing_core
which conflicts with rustc_private'stracing_core
(meaning it would not be possible to use theChromeLayer
in a context that expects aLayer
from from rustc_private'stracing_core
version).[patch]
and[replace]
sections, but although they would work for normal libraries, they don't seem to behave as expected when the crate to replace comes fromrustc_private
, see this Zulip comment for a list of experimentsmiri.rs
so the file is less cluttered.trace/
(like done now) or should I rather move them underbin/
, since onlybin/miri.rs
uses those functions?ChromeLayer
internally starts a thread to write data to file, and thus relies on a guard to properly flush the file and terminate the thread when dropped. Sincestd::process::exit()
was being called in a few places, I had to restructure the code a bit to avoid exiting directly (which wouldn't calldrop()
on the guard).rustc_driver::catch_fatal_errors()
. After modifyingrun_compiler_then_exit
to not exit directly, I could confirm that the tracing file was being flushed correctly in case of a compiler error by runningRUSTC_LOG=1 ./miri run --features tracing FILE_WITH_SYNTAX_ERRORS
.init_early_loggers()
after argument parsing, is this ok? I did not see any log/trace call during argument parsing anyway. This avoids having to refactorshow_error!()
to not exit() directly