-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix exception handling in the prestub worker (#111937)
* Fix exception handling in prestub worker There is a bug in the new exception handling when ThePreStub is called from CallDescrWorkerInternal and the exception is propagated through that. One of such cases is when a managed class is being initialized during JITting and the constructor is in an assembly that's not found. The bug results in skipping all the native frames upto a managed frame that called that native chain that lead to the exception. In the specific case I've mentioned, a lock in the native code is left in locked state. That later leads to a hang. This was case was observed with Roslyn invoking an analyzer where one of the dependencies was missing. The fix is to ensure that when ThePreStub is called by CallDescrWorkerInternal, the exception is not caught in the PreStubWorker. It is left flowing into the native calling code instead. On Windows, we also need to prevent the ProcessCLRException invocation to call into the managed exception handling code. * Regression test * Fix ExternalMethodFixupWorker and VSD_ResolveWorker too These two need the same treatment when they end up being called from CallDescrWorkerInternal. Add regression tests for those cases too. These two cases don't result in a visible failure, so the regression tests just exercise the specific code paths. * Disable the regression test for NativeAOT / MonoAOT * Reverting change in PrestubWorker_Preemptive This change is not needed, as that function cannot be called via CallDescrWorker. * Few forgotten cleanups * Remove the RequiresProcessIsolation * Disable the regression test for WASM * Attempt to properly disable the test for WASM * Another attempt to prevent running the test on WASM
- Loading branch information
Showing
12 changed files
with
270 additions
and
62 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
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
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
14 changes: 14 additions & 0 deletions
14
src/tests/Regressions/coreclr/GitHub_76531/dependencytodelete.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,14 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
|
||
namespace Dependency | ||
{ | ||
public class DependencyClass | ||
{ | ||
public static void Test() | ||
{ | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/tests/Regressions/coreclr/GitHub_76531/dependencytodelete.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,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<CLRTestKind>BuildOnly</CLRTestKind> | ||
<OutputType>Library</OutputType> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="dependencytodelete.cs" /> | ||
</ItemGroup> | ||
</Project> |
17 changes: 17 additions & 0 deletions
17
src/tests/Regressions/coreclr/GitHub_76531/tailcallinvoker.il
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,17 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
.assembly extern legacy library mscorlib {} | ||
.assembly extern dependencytodelete {} | ||
.assembly 'tailcallinvoker' {} | ||
|
||
.class public sequential ansi sealed beforefieldinit TailCallInvoker | ||
extends [mscorlib]System.Object | ||
{ | ||
.method public static void Test() cil managed noinlining | ||
{ | ||
.maxstack 1 | ||
tail. call void [dependencytodelete]Dependency.DependencyClass::Test() | ||
ret | ||
} // end of method TailCallInvoker.Test | ||
} // end of class TailCallInvoker |
10 changes: 10 additions & 0 deletions
10
src/tests/Regressions/coreclr/GitHub_76531/tailcallinvoker.ilproj
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,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.IL"> | ||
<PropertyGroup> | ||
<CLRTestKind>BuildOnly</CLRTestKind> | ||
<OutputType>Library</OutputType> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="tailcallinvoker.il" /> | ||
<ProjectReference Include="dependencytodelete.csproj" /> | ||
</ItemGroup> | ||
</Project> |
Oops, something went wrong.