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

Fix concurrent panics and backtraces #242

Merged
merged 1 commit into from
Aug 19, 2019
Merged

Conversation

alexcrichton
Copy link
Member

On Windows dbghelp.dll is required to be used from only one thread at
a time, and while this crate provides that guarantee this crate does not
synchronize with itself in the standard library. This commit solves this
issue by using a Windows-specific trick by creating a named mutex for
synchronization.

When this crate is updated in the standard library it means that the
named mutex here will be shared with the standard library, so the
standard library and this crate should be sharing the same
synchronization primitive and should be able to coordinate calls to
dbghelp.dll.

More details are included in the commit itself, but this should...

Closes #230

@alexcrichton
Copy link
Member Author

Note that a test was included in #241, but such a test won't work until we've updated this crate in the standard library itself, so I haven't included the test just yet.

r? @sfackler

src/dbghelp.rs Outdated

/// Unsafe because this requires external synchronization, must be done
/// inside of the same lock as all other backtrace operations.
/// Initialize all supoprt necessary to access `dbghelp` API functions from this
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// Initialize all supoprt necessary to access `dbghelp` API functions from this
/// Initialize all support necessary to access `dbghelp` API functions from this

On Windows `dbghelp.dll` is required to be used from only one thread at
a time, and while this crate provides that guarantee this crate does not
synchronize with itself in the standard library. This commit solves this
issue by using a Windows-specific trick by creating a named mutex for
synchronization.

When this crate is updated in the standard library it means that the
named mutex here will be shared with the standard library, so the
standard library and this crate should be sharing the same
synchronization primitive and should be able to coordinate calls to
`dbghelp.dll`.

More details are included in the commit itself, but this should...

Closes #230
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.

Synchronize dbghelp with the standard library
2 participants