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: obtain ldrlock before dumping leaks, to avoid deadlocks #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rglarix
Copy link

@rglarix rglarix commented Mar 16, 2017

While dumping leaks, vld calls GetModuleName during callstack resolving, but this function needs ldrlock.
If other threads call functions taking ldrlock and also triggering vld code (e.g. module unloading) this leads to a deadlock.
The thread dumping leaks has g_heapMapLock and wants ldrlock, while the other has ldrlock (usually obtained directly by the windows method) and wants g_heapMapLock.

This patch fixes this situation by just taking ldrlock before doing a leak dump

…olving callstack (e.g. GetModuleName)

While dumping leaks, vld calls GetModuleName during callstack resolving, but this function takes ldrlock.  If other threads call functions taking ldrlock and also triggering vld code (e.g. module unloading) this leads to a deadlock.

Signed-off-by: rglarix <[email protected]>
@KindDragon
Copy link
Owner

@rglarix Thank you for all PR's. I will try to find time to review in the coming weeks. We also need to try fix build on AppVeyor

@rglarix
Copy link
Author

rglarix commented Mar 27, 2017

Great, thank you.
BTW, I've used vld to track a nasty memory increase bug in a complex multithreaded application. It worked like a charm, very useful indeed.

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.

2 participants