-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[runtime] Don't do GC Unsafe transition in mono_gchandle_free #15214
Merged
marek-safar
merged 3 commits into
mono:master
from
lambdageek:no-gc-unsafe-gchandle-free
Jun 19, 2019
Merged
[runtime] Don't do GC Unsafe transition in mono_gchandle_free #15214
marek-safar
merged 3 commits into
mono:master
from
lambdageek:no-gc-unsafe-gchandle-free
Jun 19, 2019
Conversation
This file contains 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
…hed to the runtime. Some profiler events (for example gc_handle_deleted) could be raised on threads that aren't attached to the runtime. Since the thread won't participate in Mono's stop the world (since the runtime can't see it), there's no need to do the transition to GC Safe while the thread is trying to grab the profiler buffer lock.
Xamarin.Mac can call back here from a native thread that isn't attached to the runtime. SGen gchandle code is lockfree, and the profiler event can fire without involving Mono.
Sample stack trace:
|
Please cherry pick to 2019-02 and notify us when it lands. |
lambdageek
force-pushed
the
no-gc-unsafe-gchandle-free
branch
from
June 17, 2019 22:23
e2f084f
to
57c01ce
Compare
BrzVlad
approved these changes
Jun 18, 2019
lateralusX
requested changes
Jun 18, 2019
lambdageek
force-pushed
the
no-gc-unsafe-gchandle-free
branch
from
June 18, 2019 14:20
57c01ce
to
317d13f
Compare
lateralusX
approved these changes
Jun 18, 2019
@monojenkins backport to 2019-06 |
This was referenced Jun 18, 2019
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.
Revert one part of #14979 -
mono_gchandle_free
can be called by Xamarin.Mac formxamarin_dispose_helper
which can run on a thread that's not attached to the runtime.This is fine for SGen since the gchandle code is lockfree.
SGen also calls back into Mono, which fires a profiler event. The profiler has its own mechanism for tracking threads, but in
buffer_lock()
we need to make sure that we don't do the Mono thread state transitions if the thread is attached to the profiler but not to Mono.Follow-up PR for #14975