Fix: Eliminate possible deadlock related to memory allocation on global heap#232
Fix: Eliminate possible deadlock related to memory allocation on global heap#232adams85 wants to merge 1 commit intomicrosoft:masterfrom
Conversation
|
|
|
Ah nevermind, I didn't notice this was in DetourTransactionBegin, before any thread could be suspended. This is good then. |
src/detours.cpp
Outdated
| s_nPendingThreadId = 0; | ||
|
|
||
| // There is nothing we can do if this fails. | ||
| HeapUnlock(GetProcessHeap()); |
There was a problem hiding this comment.
We should really report this if it fails, because "nobody can use the global heap anymore" seems like a pretty big problem
There was a problem hiding this comment.
Also, since the heap is locked after s_nPendingThreadId is set in DetourTransactionBegin, we should probably unlock the heap before allowing another thread to start a transaction, so before resetting s_nPendingThreadId here
src/detours.cpp
Outdated
| } | ||
|
|
||
| // There is nothing we can do if this fails. | ||
| HeapUnlock(GetProcessHeap()); |
|
Thanks for the feedback. I've updated the PR. |
|
|
|
@sonyps5201314 So, as I understand, the main problem with the It looks like then there's no other foolproof solution than using |
|
@adams85 |
Addresses #70 by utilizing the
HeapLock/HeapUnlockAPIs as discussed in the issue.Microsoft Reviewers: Open in CodeFlow