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

[release/6.0] Make sure EventPipe streaming thread won't write session->streaming_thread after session free. #58710

Merged
merged 1 commit into from
Sep 8, 2021

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 6, 2021

Backport of #58615 to release/6.0

/cc @lateralusX

Customer Impact

Race condition writing to memory after free causing rare, but hard to diagnose runtime AV's. Only reproduced on CI so far only seen on CoreCLR, but could happen on all platforms, including platforms handled by MonoVM. Crash described in several issues like #57461.

Testing

Have been hit on CI multiple times over the last 3 week's, so we should have CI test cases the runs this code path very frequently (since the window for this race condition is small).

Risk

Low, we have many CI tests cover this code path and resetting the memory area to NULL is currently done to preventing future issues if we add logic acting on this field (like restart streaming on existing session using a different streaming thread), so no code currently depends on the value written into the field and therefore not affected.

…hread after session free.

In case where ep_disable is called by a different thread (close IPC command)
there was a race between streaming threads setting
session->streaming_thread to NULL and IPC command triggering a call
to disable_holding_lock and freeing session.

Resetting the streaming_thread in streaming thread must happens before
it signals its shutdown event to prevent the race.
@lateralusX
Copy link
Member

lateralusX commented Sep 7, 2021

/azp run runtime

@azure-pipelines
Copy link

You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list.

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@jeffschwMSFT jeffschwMSFT left a comment

Choose a reason for hiding this comment

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

Approved. Please get a code review and once we have a green ci we can merge.

@josalem
Copy link
Contributor

josalem commented Sep 7, 2021

It looks like all the CI failures were Helix/Infrastructure related. I think a re-run should ameliorate them.

@Anipik Anipik merged commit 66c228e into release/6.0 Sep 8, 2021
@akoeplinger akoeplinger deleted the backport/pr-58615-to-release/6.0 branch September 9, 2021 11:25
@ghost ghost locked as resolved and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants