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

Ignore return of SymInitializeW on Windows #231

Merged
merged 1 commit into from
Jul 31, 2019

Commits on Jul 31, 2019

  1. Ignore return of SymInitializeW on Windows

    This commit updates the behavior of backtraces on Windows to execute
    `SymInitializeW` globally once-per-process and ignore the return value
    as to whether it succeeded or not. This undoes previous work in this
    crate to specifically check the return value, and this is a behavior
    update for the standard library when this goes into the standard
    library.
    
    The `SymInitializeW` function is required to be called on MSVC before
    any backtraces can be captured or before any addresses can be
    symbolized. This function is quite slow. It can only be called
    once-per-process and there's a corresponding `SymCleanup` to undo the
    work of `SymInitializeW`.
    
    The behavior of what to do with `SymInitializeW` has changed a lot over
    time in this crate. The very first implementation for Windows paired
    with `SymCleanup`. Then reports of slowness at rust-lang/rustup#591
    led to ac8c6d2 where `SymCleanup` was removed. This led to #165 where
    because the standard library still checked `SymInitializeW`'s return
    value and called `SymCleanup` generating a backtrace with this crate
    would break `RUST_BACKTRACE=1`. Finally (and expectedly) the performance
    report has come back as #229 for this crate.
    
    I'm proposing that the final nail is put in this coffin at this point
    where this crate will ignore the return value of `SymInitializeW`,
    initializing symbols once per process globally. This update will go into
    the standard library and get updated on the stable channel eventually,
    meaning both libstd and this crate will be able to work with one another
    and only initialize the process's symbols once globally. This does mean
    that there will be a period of "breakage" where we will continue to make
    `RUST_BACKTRACE=1` not useful if this crate is used on MSVC, but that's
    sort of the extension of the status quo as of a month or so ago. This
    will eventually be fixed once the stable channel of Rust is updated.
    alexcrichton committed Jul 31, 2019
    Configuration menu
    Copy the full SHA
    e6ac926 View commit details
    Browse the repository at this point in the history