Skip to content

data race fix#29

Merged
dcristoloveanu merged 1 commit intoAzure:developfrom
OleksiiiSemko:bugfix/data-race-callstack-destructor
Nov 5, 2025
Merged

data race fix#29
dcristoloveanu merged 1 commit intoAzure:developfrom
OleksiiiSemko:bugfix/data-race-callstack-destructor

Conversation

@OleksiiiSemko
Copy link

@OleksiiiSemko OleksiiiSemko commented Dec 12, 2023

Fix of the #28 issue.
The Callstack structure is reset inside the CaptureContext destructor and deleted inside the unmap method. CaptureContext destructor and unmap method can be called in separate threads but std::unordered_map restore method is not threadsafe and the call is not protected by the critical section, because of this the Callstack destructor can be called twice for the same object.

@Neustradamus
Copy link

@OleksiiiSemko, @mattdurak: Any progress on it?

@mattdurak
Copy link

Seems safe, likely we would need to validate it for our use case, FYI @dcristoloveanu

Copy link
Member

@dcristoloveanu dcristoloveanu left a comment

Choose a reason for hiding this comment

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

:shipit:

@dcristoloveanu dcristoloveanu merged commit 7c9d292 into Azure:develop Nov 5, 2025
@dcristoloveanu
Copy link
Member

It turns out that I just spend some time debugging exactly the same race.
My fix for it was to pass the callstack into map and remap rather than extract as an out arg pBlockInfo, but technically both fixes achieve the exact same thing, so I will take the fix from you @OleksiiiSemko.
For reference, the fix I did is in the crash_workaround branch.

dcristoloveanu pushed a commit that referenced this pull request Nov 5, 2025
Co-authored-by: Oleksii Semko <oleksii.semko@ext.nng.com>
dcristoloveanu added a commit that referenced this pull request Nov 5, 2025
Co-authored-by: Oleksii <oleksa120699@gmail.com>
Co-authored-by: Oleksii Semko <oleksii.semko@ext.nng.com>
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.

4 participants