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

[6.0.100-preview.7.21356.4] Access violation error in OrchardCMS #55255

Closed
Junjun-zhao opened this issue Jul 7, 2021 · 5 comments
Closed

[6.0.100-preview.7.21356.4] Access violation error in OrchardCMS #55255

Junjun-zhao opened this issue Jul 7, 2021 · 5 comments

Comments

@Junjun-zhao
Copy link
Member

Application: OrchardCMS
OS: Windows 10 RS5
CPU: X64
.NET Build Number: 6.0.100-preview.7.21356.4

Verify Scenarios:

  1. Windows 10 RS5 X64 + dotnet-sdk-3.1.406 PASS
  2. Windows 10 RS5 X64 + dotnet-sdk-5.0.200 PASS
  3. Windows 10 RS5 X64 + 6.0.100-preview.6.21351.1 PASS
  4. Windows 10 RS5 X64 +6.0.100-preview.7.21356.4: Fail

App & Dump file checking at : https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1352680

Github link: https://github.com/OrchardCMS/OrchardCore

Repro steps:

This is 3.1 app, but we are running it on 6.0, machine only have 6.0 installed, and DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX=2, so it runs on 6.0

  1. Copy app to your machine.
  2. Start OrchardCore.Cms.Web.exe
  3. Go to http://localhost:5000/

Expected Result:
It should display Setup Page

Actual Result:
Page can't be found

Minimal Repro steps:

  1. Create Asp.Net Core Empty Project (3.1 or 5.0, but we will run it against .net6 runtime)
  2. Add this package from nuget :
    <PackageReference Include="OrchardCore.Application.Cms.Targets" Version="1.0.0-rc2-13450" />
  1. To setup OrchardCoreCMS, add this code in Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddOrchardCms();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}

app.UseRouting();

app.UseStaticFiles();

app.UseOrchardCore();
}
  1. Build and open http://localhost:5000

Expected Result:
It should display Setup Page

Actual Result:

Page can't be found (if we run it against .net5, it will work, this issue occurs when we run against .net6 runtime)

Stack

(2804.40a4): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
*** WARNING: Unable to verify checksum for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.0-preview.7.21352.16\coreclr.dll
KERNELBASE!RaiseException+0x69:
00007fff`a5a64b89 0f1f440000      nop     dword ptr [rax+rax]
0:018> k
 # Child-SP          RetAddr           Call Site
00 000000ed`40b7e770 00007fff`38f81ac9 KERNELBASE!RaiseException+0x69
01 000000ed`40b7e850 00007fff`38f81afb coreclr!NakedThrowHelper2+0x9
02 000000ed`40b7e880 00007fff`38f81b05 coreclr!NakedThrowHelper_RspAligned+0x1e
03 000000ed`40b7eda8 00007fff`8694c770 coreclr!NakedThrowHelper_FixRsp+0x5
04 000000ed`40b7edb0 00007fff`86950209 Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)+0x10
05 000000ed`40b7edf0 00007fff`869532bd Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.ILEmitResolverBuilder.VisitRootCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ILEmitResolverBuilderContext)+0x29
06 000000ed`40b7ee30 00007fff`86950404 Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection],[System.__Canon, System.Private.CoreLib]].VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext)+0xdbd
07 000000ed`40b7eeb0 00007fff`8695345a Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.ILEmitResolverBuilder.VisitIEnumerable(Microsoft.Extensions.DependencyInjection.ServiceLookup.IEnumerableCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ILEmitResolverBuilderContext)+0xf4
08 000000ed`40b7ef40 00007fff`869532da Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection],[System.__Canon, System.Private.CoreLib]].VisitCallSiteMain(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext)+0xd2a
09 000000ed`40b7ef80 00007fff`86951144 Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection],[System.__Canon, System.Private.CoreLib]].VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext)+0xdda
0a 000000ed`40b7f000 00007fff`8694ffaa Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.ILEmitResolverBuilder.GenerateMethodBody(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite, System.Reflection.Emit.ILGenerator)+0x8e4
0b 000000ed`40b7f190 00007fff`8694fea8 Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.ILEmitResolverBuilder.BuildTypeNoCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite)+0xea
0c 000000ed`40b7f220 00007fff`8695207c Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.ILEmitResolverBuilder.BuildType(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite)+0xa8
*** WARNING: Unable to verify checksum for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.0-preview.7.21352.16\System.Private.CoreLib.dll
*** ERROR: Module load completed but symbols could not be loaded for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.0-preview.7.21352.16\System.Private.CoreLib.dll
0d 000000ed`40b7f2b0 00007fff`37ffa219 Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine+<>c__DisplayClass2_0.<RealizeService>b__1(System.Object)+0x3c
0e 000000ed`40b7f310 00007fff`37ff910b System_Private_CoreLib!System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()+0x19
0f 000000ed`40b7f340 00007fff`38000974 System_Private_CoreLib!System.Threading.ThreadPoolWorkQueue.Dispatch()+0x1cb
10 000000ed`40b7f3d0 00007fff`37fe543f System_Private_CoreLib!System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()+0x104
11 000000ed`40b7f4e0 00007fff`38f80b63 System_Private_CoreLib!System.Threading.Thread.StartCallback()+0x3f
12 000000ed`40b7f520 00007fff`38edce94 coreclr!CallDescrWorkerInternal+0x83
13 000000ed`40b7f560 00007fff`38f69d83 coreclr!DispatchCallSimple+0x80 [D:\workspace\_work\1\s\src\coreclr\vm\callhelpers.cpp @ 220]
14 000000ed`40b7f5f0 00007fff`38e40545 coreclr!ThreadNative::KickOffThread_Worker+0x63 [D:\workspace\_work\1\s\src\coreclr\vm\comsynchronizable.cpp @ 158]
15 (Inline Function) --------`-------- coreclr!ManagedThreadBase_DispatchInner+0xd [D:\workspace\_work\1\s\src\coreclr\vm\threads.cpp @ 7253]
16 000000ed`40b7f650 00007fff`38e4044a coreclr!ManagedThreadBase_DispatchMiddle+0x85 [D:\workspace\_work\1\s\src\coreclr\vm\threads.cpp @ 7297]
17 000000ed`40b7f730 00007fff`38e40269 coreclr!ManagedThreadBase_DispatchOuter+0xae [D:\workspace\_work\1\s\src\coreclr\vm\threads.cpp @ 7456]
18 (Inline Function) --------`-------- coreclr!ManagedThreadBase_FullTransition+0x2d [D:\workspace\_work\1\s\src\coreclr\vm\threads.cpp @ 7501]
19 (Inline Function) --------`-------- coreclr!ManagedThreadBase::KickOff+0x2d [D:\workspace\_work\1\s\src\coreclr\vm\threads.cpp @ 7536]
1a 000000ed`40b7f7d0 00007fff`a64c7034 coreclr!ThreadNative::KickOffThread+0x79 [D:\workspace\_work\1\s\src\coreclr\vm\comsynchronizable.cpp @ 230]
1b 000000ed`40b7f830 00007fff`a8342651 KERNEL32!BaseThreadInitThunk+0x14
1c 000000ed`40b7f860 00000000`00000000 ntdll!RtlUserThreadStart+0x21

@dotnet-actwx-bot @dotnet/compat

@dotnet-issue-labeler dotnet-issue-labeler bot added area-Extensions-DependencyInjection untriaged New issue has not been triaged by the area owner labels Jul 7, 2021
@ghost
Copy link

ghost commented Jul 7, 2021

Tagging subscribers to this area: @eerhardt, @maryamariyan
See info in area-owners.md if you want to be subscribed.

Issue Details

Application: OrchardCMS
OS: Windows 10 RS5
CPU: X64
.NET Build Number: 6.0.100-preview.7.21356.4

Verify Scenarios:

  1. Windows 10 RS5 X64 + dotnet-sdk-3.1.406 PASS
  2. Windows 10 RS5 X64 + dotnet-sdk-5.0.200 PASS
  3. Windows 10 RS5 X64 + 6.0.100-preview.6.21351.1 PASS
  4. Windows 10 RS5 X64 +6.0.100-preview.7.21356.4: Fail

App & Dump file checking at : https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1352680

Github link: https://github.com/OrchardCMS/OrchardCore

Repro steps:

This is 3.1 app, but we are running it on 6.0, machine only have 6.0 installed, and DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX=2, so it runs on 6.0

  1. Copy app to your machine.
  2. Start OrchardCore.Cms.Web.exe
  3. Go to http://localhost:5000/

Expected Result:
It should display Setup Page

Actual Result:
Page can't be found

Minimal Repro steps:

  1. Create Asp.Net Core Empty Project (3.1 or 5.0, but we will run it against .net6 runtime)
  2. Add this package from nuget :
    <PackageReference Include="OrchardCore.Application.Cms.Targets" Version="1.0.0-rc2-13450" />
  1. To setup OrchardCoreCMS, add this code in Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddOrchardCms();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}

app.UseRouting();

app.UseStaticFiles();

app.UseOrchardCore();
}
  1. Build and open http://localhost:5000

Expected Result:
It should display Setup Page

Actual Result:

Page can't be found (if we run it against .net5, it will work, this issue occurs when we run against .net6 runtime)

Stack

(2804.40a4): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
*** WARNING: Unable to verify checksum for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.0-preview.7.21352.16\coreclr.dll
KERNELBASE!RaiseException+0x69:
00007fff`a5a64b89 0f1f440000      nop     dword ptr [rax+rax]
0:018> k
 # Child-SP          RetAddr           Call Site
00 000000ed`40b7e770 00007fff`38f81ac9 KERNELBASE!RaiseException+0x69
01 000000ed`40b7e850 00007fff`38f81afb coreclr!NakedThrowHelper2+0x9
02 000000ed`40b7e880 00007fff`38f81b05 coreclr!NakedThrowHelper_RspAligned+0x1e
03 000000ed`40b7eda8 00007fff`8694c770 coreclr!NakedThrowHelper_FixRsp+0x5
04 000000ed`40b7edb0 00007fff`86950209 Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)+0x10
05 000000ed`40b7edf0 00007fff`869532bd Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.ILEmitResolverBuilder.VisitRootCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ILEmitResolverBuilderContext)+0x29
06 000000ed`40b7ee30 00007fff`86950404 Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection],[System.__Canon, System.Private.CoreLib]].VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext)+0xdbd
07 000000ed`40b7eeb0 00007fff`8695345a Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.ILEmitResolverBuilder.VisitIEnumerable(Microsoft.Extensions.DependencyInjection.ServiceLookup.IEnumerableCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ILEmitResolverBuilderContext)+0xf4
08 000000ed`40b7ef40 00007fff`869532da Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection],[System.__Canon, System.Private.CoreLib]].VisitCallSiteMain(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext)+0xd2a
09 000000ed`40b7ef80 00007fff`86951144 Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection],[System.__Canon, System.Private.CoreLib]].VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext)+0xdda
0a 000000ed`40b7f000 00007fff`8694ffaa Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.ILEmitResolverBuilder.GenerateMethodBody(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite, System.Reflection.Emit.ILGenerator)+0x8e4
0b 000000ed`40b7f190 00007fff`8694fea8 Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.ILEmitResolverBuilder.BuildTypeNoCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite)+0xea
0c 000000ed`40b7f220 00007fff`8695207c Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.ILEmitResolverBuilder.BuildType(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite)+0xa8
*** WARNING: Unable to verify checksum for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.0-preview.7.21352.16\System.Private.CoreLib.dll
*** ERROR: Module load completed but symbols could not be loaded for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.0-preview.7.21352.16\System.Private.CoreLib.dll
0d 000000ed`40b7f2b0 00007fff`37ffa219 Microsoft_Extensions_DependencyInjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine+<>c__DisplayClass2_0.<RealizeService>b__1(System.Object)+0x3c
0e 000000ed`40b7f310 00007fff`37ff910b System_Private_CoreLib!System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()+0x19
0f 000000ed`40b7f340 00007fff`38000974 System_Private_CoreLib!System.Threading.ThreadPoolWorkQueue.Dispatch()+0x1cb
10 000000ed`40b7f3d0 00007fff`37fe543f System_Private_CoreLib!System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()+0x104
11 000000ed`40b7f4e0 00007fff`38f80b63 System_Private_CoreLib!System.Threading.Thread.StartCallback()+0x3f
12 000000ed`40b7f520 00007fff`38edce94 coreclr!CallDescrWorkerInternal+0x83
13 000000ed`40b7f560 00007fff`38f69d83 coreclr!DispatchCallSimple+0x80 [D:\workspace\_work\1\s\src\coreclr\vm\callhelpers.cpp @ 220]
14 000000ed`40b7f5f0 00007fff`38e40545 coreclr!ThreadNative::KickOffThread_Worker+0x63 [D:\workspace\_work\1\s\src\coreclr\vm\comsynchronizable.cpp @ 158]
15 (Inline Function) --------`-------- coreclr!ManagedThreadBase_DispatchInner+0xd [D:\workspace\_work\1\s\src\coreclr\vm\threads.cpp @ 7253]
16 000000ed`40b7f650 00007fff`38e4044a coreclr!ManagedThreadBase_DispatchMiddle+0x85 [D:\workspace\_work\1\s\src\coreclr\vm\threads.cpp @ 7297]
17 000000ed`40b7f730 00007fff`38e40269 coreclr!ManagedThreadBase_DispatchOuter+0xae [D:\workspace\_work\1\s\src\coreclr\vm\threads.cpp @ 7456]
18 (Inline Function) --------`-------- coreclr!ManagedThreadBase_FullTransition+0x2d [D:\workspace\_work\1\s\src\coreclr\vm\threads.cpp @ 7501]
19 (Inline Function) --------`-------- coreclr!ManagedThreadBase::KickOff+0x2d [D:\workspace\_work\1\s\src\coreclr\vm\threads.cpp @ 7536]
1a 000000ed`40b7f7d0 00007fff`a64c7034 coreclr!ThreadNative::KickOffThread+0x79 [D:\workspace\_work\1\s\src\coreclr\vm\comsynchronizable.cpp @ 230]
1b 000000ed`40b7f830 00007fff`a8342651 KERNEL32!BaseThreadInitThunk+0x14
1c 000000ed`40b7f860 00000000`00000000 ntdll!RtlUserThreadStart+0x21

@dotnet-actwx-bot @dotnet/compat

Author: Junjun-zhao
Assignees: -
Labels:

area-Extensions-DependencyInjection, untriaged

Milestone: -

@eerhardt
Copy link
Member

eerhardt commented Jul 7, 2021

Debugging this, I'm seeing a NullReferenceException in the background due to the following:

image

That is being called by ILEmitResolverBuilder here:

image

in this case _rootScope is null. The reason it is null is because in ILEmitResolverBuilder's ctor, serviceProvider.Root is null.

image

The reason it is null is because it isn't set on the serviceProvider yet. ILEmitResolverBuilder's ctor gets invoked by GetEngine(). and GetEngine() gets invoked before .Root gets set:

image

It looks to me that we need to set .Root before calling GetEngine() in the ServiceProvider's ctor.

cc @davidfowl @pakrym

However, this background thread throwing NullReferenceException is getting caught and discarded. So I'm not sure why the page doesn't load. I'm still digging into that.

@eerhardt
Copy link
Member

eerhardt commented Jul 7, 2021

After fixing the NRE locally, I'm still seeing the app returning 404. I'm not sure why that is, debugging into the asp.net code, I get to the end of the request pipeline here:

image

But I'm not sure what should have handled the request. This looks like an asp.net bug/breaking change. @davidfowl - any idea?

@eerhardt eerhardt added this to the 6.0.0 milestone Jul 8, 2021
@eerhardt eerhardt removed the untriaged New issue has not been triaged by the area owner label Jul 8, 2021
@eerhardt eerhardt self-assigned this Jul 8, 2021
@eerhardt
Copy link
Member

eerhardt commented Jul 8, 2021

The background NullReferenceException has been fixed by #55340.

I've opened dotnet/aspnetcore#34208 for the app 404'ing on the home page, as that looks like an issue with ASP.NET.

@eerhardt eerhardt closed this as completed Jul 8, 2021
@Junjun-zhao
Copy link
Member Author

Verified and it has been fixed on SDK dotnet-sdk-6.0.100-preview.7.21363.2.

@ghost ghost locked as resolved and limited conversation to collaborators Aug 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants