This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
Fix nested spin locks in thread pool etw firing #17677
Merged
Merged
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
`UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest` fires an ETW event inside a spin lock and a nested spin lock is taken here: ``` SpinLock::GetLock + 0x8E (0x719da71d) EventPipeBufferManager::AllocateBufferForThread + 0x7B (0x71afa92e) EventPipeBufferManager::WriteEvent + 0x250 (0x71afbe0a) EventPipe::WriteEventInternal + 0x125 (0x71951c93) EventPipe::WriteEvent + 0x91 (0x71951714) EventPipeWriteEventThreadPoolEnqueue + 0x9E (0x71d468a6) FireEtwThreadPoolEnqueue + 0xF (0x71b7a04b) UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest + 0x21D (0x71b7a597) ``` Nesting spin locks is not allowed, moved the ETW firing outside the lock.
This happens I guess when this is the first event that is fired in the process (or very rarely thereafter) |
And occurred while testing tiering |
janvorli
approved these changes
Apr 19, 2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LGTM Adding @brianrob who probably has the most context on this. |
stephentoub
approved these changes
Apr 20, 2018
brianrob
approved these changes
Apr 20, 2018
@kouvel, this will happen on first event on each thread or when a thread exhausts its buffer and needs to write another event. |
I see, thanks all |
lkingsford
added a commit
to lkingsford/coreclr
that referenced
this pull request
Apr 20, 2018
Fix nested spin locks in thread pool etw firing (dotnet#17677)
kouvel
added a commit
to kouvel/coreclr
that referenced
this pull request
Aug 16, 2018
`UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest` fires an ETW event inside a spin lock and a nested spin lock is taken here: ``` SpinLock::GetLock + 0x8E (0x719da71d) EventPipeBufferManager::AllocateBufferForThread + 0x7B (0x71afa92e) EventPipeBufferManager::WriteEvent + 0x250 (0x71afbe0a) EventPipe::WriteEventInternal + 0x125 (0x71951c93) EventPipe::WriteEvent + 0x91 (0x71951714) EventPipeWriteEventThreadPoolEnqueue + 0x9E (0x71d468a6) FireEtwThreadPoolEnqueue + 0xF (0x71b7a04b) UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest + 0x21D (0x71b7a597) ``` Nesting spin locks is not allowed, moved the ETW firing outside the lock.
kouvel
added a commit
to kouvel/coreclr
that referenced
this pull request
Aug 16, 2018
Port of dotnet#17677 to 2.2 `UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest` fires an ETW event inside a spin lock and a nested spin lock is taken here: ``` SpinLock::GetLock + 0x8E (0x719da71d) EventPipeBufferManager::AllocateBufferForThread + 0x7B (0x71afa92e) EventPipeBufferManager::WriteEvent + 0x250 (0x71afbe0a) EventPipe::WriteEventInternal + 0x125 (0x71951c93) EventPipe::WriteEvent + 0x91 (0x71951714) EventPipeWriteEventThreadPoolEnqueue + 0x9E (0x71d468a6) FireEtwThreadPoolEnqueue + 0xF (0x71b7a04b) UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest + 0x21D (0x71b7a597) ``` Nesting spin locks is not allowed, moved the ETW firing outside the lock.
kouvel
added a commit
to kouvel/coreclr
that referenced
this pull request
Aug 16, 2018
Port of dotnet#17677 to 2.2 `UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest` fires an ETW event inside a spin lock and a nested spin lock is taken here: ``` SpinLock::GetLock + 0x8E (0x719da71d) EventPipeBufferManager::AllocateBufferForThread + 0x7B (0x71afa92e) EventPipeBufferManager::WriteEvent + 0x250 (0x71afbe0a) EventPipe::WriteEventInternal + 0x125 (0x71951c93) EventPipe::WriteEvent + 0x91 (0x71951714) EventPipeWriteEventThreadPoolEnqueue + 0x9E (0x71d468a6) FireEtwThreadPoolEnqueue + 0xF (0x71b7a04b) UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest + 0x21D (0x71b7a597) ``` Nesting spin locks is not allowed, moved the ETW firing outside the lock.
kouvel
added a commit
to kouvel/coreclr
that referenced
this pull request
Aug 20, 2018
Port of dotnet#17677 to 2.2 `UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest` fires an ETW event inside a spin lock and a nested spin lock is taken here: ``` SpinLock::GetLock + 0x8E (0x719da71d) EventPipeBufferManager::AllocateBufferForThread + 0x7B (0x71afa92e) EventPipeBufferManager::WriteEvent + 0x250 (0x71afbe0a) EventPipe::WriteEventInternal + 0x125 (0x71951c93) EventPipe::WriteEvent + 0x91 (0x71951714) EventPipeWriteEventThreadPoolEnqueue + 0x9E (0x71d468a6) FireEtwThreadPoolEnqueue + 0xF (0x71b7a04b) UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest + 0x21D (0x71b7a597) ``` Nesting spin locks is not allowed, moved the ETW firing outside the lock.
kouvel
added a commit
to kouvel/coreclr
that referenced
this pull request
Aug 22, 2018
Port of dotnet#17677 to 2.2 `UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest` fires an ETW event inside a spin lock and a nested spin lock is taken here: ``` SpinLock::GetLock + 0x8E (0x719da71d) EventPipeBufferManager::AllocateBufferForThread + 0x7B (0x71afa92e) EventPipeBufferManager::WriteEvent + 0x250 (0x71afbe0a) EventPipe::WriteEventInternal + 0x125 (0x71951c93) EventPipe::WriteEvent + 0x91 (0x71951714) EventPipeWriteEventThreadPoolEnqueue + 0x9E (0x71d468a6) FireEtwThreadPoolEnqueue + 0xF (0x71b7a04b) UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest + 0x21D (0x71b7a597) ``` Nesting spin locks is not allowed, moved the ETW firing outside the lock.
kouvel
added a commit
to kouvel/coreclr
that referenced
this pull request
Aug 22, 2018
Port of dotnet#17677 to 2.2. `UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest` fires an ETW event inside a spin lock and a nested spin lock is taken here: ``` SpinLock::GetLock + 0x8E (0x719da71d) EventPipeBufferManager::AllocateBufferForThread + 0x7B (0x71afa92e) EventPipeBufferManager::WriteEvent + 0x250 (0x71afbe0a) EventPipe::WriteEventInternal + 0x125 (0x71951c93) EventPipe::WriteEvent + 0x91 (0x71951714) EventPipeWriteEventThreadPoolEnqueue + 0x9E (0x71d468a6) FireEtwThreadPoolEnqueue + 0xF (0x71b7a04b) UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest + 0x21D (0x71b7a597) ``` Nesting spin locks is not allowed, moved the ETW firing outside the lock.
kouvel
added a commit
to kouvel/coreclr
that referenced
this pull request
Aug 24, 2018
Port of dotnet#17677 to 2.2 `UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest` fires an ETW event inside a spin lock and a nested spin lock is taken here: ``` SpinLock::GetLock + 0x8E (0x719da71d) EventPipeBufferManager::AllocateBufferForThread + 0x7B (0x71afa92e) EventPipeBufferManager::WriteEvent + 0x250 (0x71afbe0a) EventPipe::WriteEventInternal + 0x125 (0x71951c93) EventPipe::WriteEvent + 0x91 (0x71951714) EventPipeWriteEventThreadPoolEnqueue + 0x9E (0x71d468a6) FireEtwThreadPoolEnqueue + 0xF (0x71b7a04b) UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest + 0x21D (0x71b7a597) ``` Nesting spin locks is not allowed, moved the ETW firing outside the lock.
kouvel
added a commit
to kouvel/coreclr
that referenced
this pull request
Aug 27, 2018
Port of dotnet#17677 to 2.2 `UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest` fires an ETW event inside a spin lock and a nested spin lock is taken here: ``` SpinLock::GetLock + 0x8E (0x719da71d) EventPipeBufferManager::AllocateBufferForThread + 0x7B (0x71afa92e) EventPipeBufferManager::WriteEvent + 0x250 (0x71afbe0a) EventPipe::WriteEventInternal + 0x125 (0x71951c93) EventPipe::WriteEvent + 0x91 (0x71951714) EventPipeWriteEventThreadPoolEnqueue + 0x9E (0x71d468a6) FireEtwThreadPoolEnqueue + 0xF (0x71b7a04b) UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest + 0x21D (0x71b7a597) ``` Nesting spin locks is not allowed, moved the ETW firing outside the lock.
kouvel
added a commit
that referenced
this pull request
Aug 30, 2018
This is a port of several changes that went into master after 2.2 forked, including dependencies for, and enabling tiered compilation by default in 2.2. Quick summary of commits is below, see the commit descriptions and PRs for more info. - Commit 1 - Fix nested spin locks in thread pool etw firing (#17677) - Fixes a lock nesting issue when there is an ETW listener, which can occur without tiering, but is almost deterministic with tiering enabled because the first event that is fired typically hits this code path - Commit 2 - Don't close the JIT func info file on shutdown (#18060) - Fixes a crash during shutdown that only occurs when JIT logging is enabled (typically in the coreclr tests and CI). More frequent with tiering enabled because of different JIT timing and background jitting. - Commit 3 - Apply tiering's call counting delay more broadly (#18610) - Fixes a perf issue when tiering is enabled in server first-request scenarios where there is a significant gap between process startup and first request - Commit 4 - Changes only affect debug builds - Eliminate arm64 contract asserts (#19015) - Fixes some incorrect asserts that trigger more frequently with tiering - Commit 5 - Use 16 bytes to spill SIMD12 (#19237) - Fixes a crash in corefx System.Numerics.Tests.Vector3Tests.Vector3EqualsTest. Occurs with minopt JIT or with tiering. - Commit 6 - Fix an apartment state issue (partial port of #19384) - This is a partial port of this PR (only the portion that addresses issue #17822) - This is a breaking change, though a minor one that we have concluded is an acceptable risk to take for 2.2 - Fixes a behavioral difference that can be seen more easily tiering enabled in APIs on the `Thread` class relevant to apartment state. The issue can also be seen in some cases when tiering is disabled. - Commit 7 - Enable Tiered Compilation by default (#19525) - Enables tiering by default, can be disabled through environment, or through .csproj/.json when using dotnet - Removes deprecated config variable (EXPERIMENTAL_TieredCompilation) that was previously exposed in 2.1 along with the current config variable (TieredCompilation), along with miscellaneous test fixes - Commit 8 - Changes only affect tests - Fix tiered compilation option for case-sensitive systems (#19567) - Fixes tiering environment variable casing for non-Windows platforms - Commit 9 - Disable tiered compilation on arm64 - There is an open issue that may be partly related to minopts on arm64 (https://github.com/dotnet/coreclr/issues/18895). Disabling tiering by default on arm64 to limit exposing new issues. This change would be followed up with dotnet/corefx#31822 - Adds tests for Commit 6 - Fix an apartment state issue (partial port of #19384) - Changes only affect tests Closes https://github.com/dotnet/coreclr/issues/18973
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
UnManagedPerAppDomainTPCount::QueueUnmanagedWorkRequest
fires an ETW event inside a spin lock and a nested spin lock is taken here:Nesting spin locks is not allowed, moved the ETW firing outside the lock.