forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix assertion failure / crash in multi-core JIT
- When the recorder times out it doesn't actually stop profiling, but writes out the profile - The app may later stop profiling, and then it tries to write the profile again - PR dotnet#48326 fairly expected that the profile is only written once (some state is mutated) - The non-timeout stop-profile path was also not stopping the timer - Fix for dotnet#53014 in main
- Loading branch information
Showing
4 changed files
with
59 additions
and
18 deletions.
There are no files selected for viewing
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
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
33 changes: 33 additions & 0 deletions
33
src/tests/baseservices/TieredCompilation/McjRecorderTimeoutBeforeStop.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Runtime; | ||
using System.Runtime.CompilerServices; | ||
using System.Threading; | ||
|
||
public static class BasicTest | ||
{ | ||
private static int Main() | ||
{ | ||
const int Pass = 100; | ||
|
||
ProfileOptimization.SetProfileRoot(Environment.CurrentDirectory); | ||
ProfileOptimization.StartProfile("profile.mcj"); | ||
|
||
// Record a method | ||
Foo(); | ||
|
||
// Let the multi-core JIT recorder time out. The timeout is set to 1 s in the test project. | ||
Thread.Sleep(2000); | ||
|
||
// Stop the profile again after timeout (just verifying that it works) | ||
ProfileOptimization.StartProfile(null); | ||
return Pass; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
private static void Foo() | ||
{ | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/tests/baseservices/TieredCompilation/McjRecorderTimeoutBeforeStop.csproj
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<Optimize>true</Optimize> | ||
<CLRTestPriority>0</CLRTestPriority> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="McjRecorderTimeoutBeforeStop.cs" /> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<CLRTestBatchPreCommands><![CDATA[ | ||
$(CLRTestBatchPreCommands) | ||
set COMPlus_MultiCoreJitProfileWriteDelay=1 | ||
]]></CLRTestBatchPreCommands> | ||
<BashCLRTestPreCommands><![CDATA[ | ||
$(BashCLRTestPreCommands) | ||
export COMPlus_MultiCoreJitProfileWriteDelay=1 | ||
]]></BashCLRTestPreCommands> | ||
</PropertyGroup> | ||
</Project> |