Repository navigation
theading: Fix segfault in onCleanup - #30
Merged
Merged
Conversation
On some platforms, deleting elements from std::map::iterator while iterating through it can cause a segfault. erase() invalidates the iterator
mcoffin
force-pushed
the
threading-segfault
branch
from
December 11, 2021 21:46
f90b750 to
8c5321f
Compare
Member
|
OMG!!!
I love you dude! This probably caused a long standing obscure bug of
freeze/failing to process requests that I couldn't diagnose
Matt Coffin ***@***.***> schrieb am Sa., 11. Dez. 2021, 22:11:
… On some platforms, deleting elements from std::map::iterator while
iterating through it can cause a segfault.
The reason being that calling erase() invalidates the iterator(s). This
was observed to cause a problem when running intercept code on Windows 10
Server.
Despite this (apparently) not being an issue due to implementation details
with g++ 11 and the MSVC runtimes on Win10 Home/Pro, this was a usage of
undefined behavior, and removing it resolves the issue we observed on Win10
server.
------------------------------
You can view, comment on, or merge this pull request online at:
#30
Commit Summary
- f90b750
<f90b750>
theading: Fix segfault in onCleanup
File Changes
(1 file <https://github.com/intercept/intercept-database/pull/30/files>)
- *M* src/threading.cpp
<https://github.com/intercept/intercept-database/pull/30/files#diff-6b6ea96e81ffe2e34b4a3992fc4d28467e672a36bff4a5b02b3c84bedfc45508>
(7)
Patch Links:
- https://github.com/intercept/intercept-database/pull/30.patch
- https://github.com/intercept/intercept-database/pull/30.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#30>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA4X6ZMLVLJH3FASVK7VPTDUQO5BRANCNFSM5J3NVFNA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On some platforms, deleting elements from std::map::iterator while iterating through it can cause a segfault.
The reason being that calling erase() invalidates the iterator(s). This was observed to cause a problem when running intercept code on Windows 10 Server.
Despite this (apparently) not being an issue due to implementation details with g++ 11 and the MSVC runtimes on Win10 Home/Pro, this was a usage of undefined behavior, and removing it resolves the issue we observed on Win10 server.