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

SingleFile asp.net apps throw an exception #54759

Closed
mangod9 opened this issue Jun 25, 2021 · 9 comments
Closed

SingleFile asp.net apps throw an exception #54759

mangod9 opened this issue Jun 25, 2021 · 9 comments

Comments

@mangod9
Copy link
Member

mangod9 commented Jun 25, 2021

Description

Asp.net singleFile apps throw the following exception:

[STDERR] Unhandled exception. System.DllNotFoundException: Unable to load shared library 'libSystem.Native' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibSystem.Native: cannot open shared object file: No such file or directory
[STDERR]    at System.Runtime.InteropServices.Marshal.AllocBSTRByteLen(UInt32 length) in System.Private.CoreLib.dll:token 0x600463f+0x1d
[STDERR]    at System.StubHelpers.AnsiBSTRMarshaler.ConvertToNative(Int32 flags, String strManaged) in System.Private.CoreLib.dll:token 0x6003357+0x2f
[STDERR]    at Interop.Globalization.GetSortHandle(String localeName, IntPtr& sortHandle) in System.Private.CoreLib.dll:token 0x600001c+0x25
[STDERR]    at System.Globalization.CompareInfo.SortHandleCache.GetCachedSortHandle(String sortName) in System.Private.CoreLib.dll:token 0x600204f+0x1f
[STDERR]    at System.Globalization.CompareInfo.IcuInitSortHandle() in System.Private.CoreLib.dll:token 0x6002033+0x77
[STDERR]    at System.Globalization.CultureInfo.get_CompareInfo() in System.Private.CoreLib.dll:token 0x6002106+0xa
[STDERR]    at System.String.StartsWith(String value, StringComparison comparisonType) in System.Private.CoreLib.dll:token 0x60006d1+0x0
[STDERR]    at System.String.StartsWith(String value) in System.Private.CoreLib.dll:token 0x60006d0+0xe
[STDERR]    at Microsoft.Extensions.Configuration.CommandLine.CommandLineConfigurationProvider.Load() in Microsoft.Extensions.Configuration.CommandLine.dll:token 0x600001c+0x27
[STDERR]    at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers) in Microsoft.Extensions.Configuration.dll:token 0x600003f+0x52
[STDERR]    at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build() in Microsoft.Extensions.Configuration.dll:token 0x6000028+0x3e
[STDERR]    at Benchmarks.Program.Main(String[] args) in Benchmarks.dll:token 0x6000032+0xfa

Configuration

1. dotnet new webapi
2. dotnet publish -r linux-x64 /p:PublishSingleFile=true

Regression?

Yes, looks related to this change: #54006

@ghost
Copy link

ghost commented Jun 25, 2021

Tagging subscribers to this area: @agocke, @vitek-karas, @VSadov
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

Asp.net singleFile apps throw the following exception:

[STDERR] Unhandled exception. System.DllNotFoundException: Unable to load shared library 'libSystem.Native' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibSystem.Native: cannot open shared object file: No such file or directory
[STDERR]    at System.Runtime.InteropServices.Marshal.AllocBSTRByteLen(UInt32 length) in System.Private.CoreLib.dll:token 0x600463f+0x1d
[STDERR]    at System.StubHelpers.AnsiBSTRMarshaler.ConvertToNative(Int32 flags, String strManaged) in System.Private.CoreLib.dll:token 0x6003357+0x2f
[STDERR]    at Interop.Globalization.GetSortHandle(String localeName, IntPtr& sortHandle) in System.Private.CoreLib.dll:token 0x600001c+0x25
[STDERR]    at System.Globalization.CompareInfo.SortHandleCache.GetCachedSortHandle(String sortName) in System.Private.CoreLib.dll:token 0x600204f+0x1f
[STDERR]    at System.Globalization.CompareInfo.IcuInitSortHandle() in System.Private.CoreLib.dll:token 0x6002033+0x77
[STDERR]    at System.Globalization.CultureInfo.get_CompareInfo() in System.Private.CoreLib.dll:token 0x6002106+0xa
[STDERR]    at System.String.StartsWith(String value, StringComparison comparisonType) in System.Private.CoreLib.dll:token 0x60006d1+0x0
[STDERR]    at System.String.StartsWith(String value) in System.Private.CoreLib.dll:token 0x60006d0+0xe
[STDERR]    at Microsoft.Extensions.Configuration.CommandLine.CommandLineConfigurationProvider.Load() in Microsoft.Extensions.Configuration.CommandLine.dll:token 0x600001c+0x27
[STDERR]    at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers) in Microsoft.Extensions.Configuration.dll:token 0x600003f+0x52
[STDERR]    at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build() in Microsoft.Extensions.Configuration.dll:token 0x6000028+0x3e
[STDERR]    at Benchmarks.Program.Main(String[] args) in Benchmarks.dll:token 0x6000032+0xfa

Configuration

1. dotnet new webapi
2. dotnet publish -r lin-x64 /p:PublishSingleFile=true

Regression?

Yes, looks related to this change: #54006

Author: mangod9
Assignees: -
Labels:

area-Single-File

Milestone: -

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Jun 25, 2021
@mangod9
Copy link
Member Author

mangod9 commented Jun 25, 2021

@tannergooding as fyi..

@mangod9
Copy link
Member Author

mangod9 commented Jun 25, 2021

actually I am unable to repro with a vanilla asp.net app. @sebastienros assume this is specific to the asp.net Benchmarks infra then? Do you have the exact commandline that fails ?

@sebastienros
Copy link
Member

sebastienros commented Jun 25, 2021

This might be triggered by a specific call when the configuration for this app is invoked. To repro I would suggest to clone https://github.com/aspnet/Benchmarks, then build src/Benchmarks with this command line, using the latest SDK:

dotnet publish Benchmarks.csproj -c Release -o ./published /p:MicrosoftNETCoreAppPackageVersion=6.0.0-preview.7.21325.9 /p:MicrosoftAspNetCoreAppPackageVersion=6.0.0-preview.7.21325.3 /p:BenchmarksTargetFramework=net6.0 /p:PublishReadyToRun=true /p:PublishSingleFile=true --framework net6.0 --self-contained -r linux-x64 

Then the error should happen on the first request.
We can also provide the self-contained published folder if someone prefers that.

Update:
The ASP.NET and NetCoreApp version in this example will probably not match the ones provided by the SDK you download. Please update these version in the command lines with the ones you downloaded.

@VSadov
Copy link
Member

VSadov commented Jun 25, 2021

@sebastienros I followed the steps above and I get

published$ ./Benchmarks

ASP.NET Core Benchmarks
-----------------------
Current directory: /SSD/vsadov/Benchmarks/src/Benchmarks/published
AspNetCore version: 6.0.0-preview.7.21322.5+13943a5b2e4051b0f478f59c560f197582ebcf0b
.NET Runtime version: 6.0.0-preview.7.21321.15+2a43c07bb82113a029090730d8ca001a68b22c05
EFCore version: 6.0.0-preview.4.21253.1
Environment.ProcessorCount: 8
Unhandled exception. System.InvalidOperationException: Transport must be specified
   at Benchmarks.Program.Main(String[] args) in /SSD/vsadov/Benchmarks/src/Benchmarks/Program.cs:line 163
Aborted

Not sure if this is getting further than in the original repro or fails before hitting the issue.

@VSadov
Copy link
Member

VSadov commented Jun 25, 2021

This is with 6.0.100-preview.7.21323.6

@mangod9
Copy link
Member Author

mangod9 commented Jun 25, 2021

you need to specify a transport. I cannot repro the issue with these either:

./Benchmarks --kestreltransport sockets
ASP.NET Core Benchmarks
-----------------------
Current directory: /home/magodse/p7/Benchmarks/src/published
AspNetCore version: 6.0.0-preview.7.21323.6+7b28c2b572cf32cf3c874d637ca8337a3b459830
.NET Runtime version: 6.0.0-preview.7.21324.1+7833828914a42f8c99dfa6f18ccd47f99dc2b56e
EFCore version: 6.0.0-preview.4.21253.1
Environment.ProcessorCount: 12
The following scenarios were enabled:
  Json -> /json

Database: None
WAL: False
Using server Kestrel
Server GC is currently ENABLED
Press 'C' to force GC or any other key to display GC stats

Using Sockets with 12 threads
Hosting environment: Production
Now listening on: http://127.0.0.1:5000

and used curl to send a request:

:~$ curl --get http://127.0.0.1:5000/json
{"message":"Hello, World!"}

@agocke agocke added this to the 6.0.0 milestone Jul 15, 2021
@agocke agocke removed the untriaged New issue has not been triaged by the area owner label Jul 15, 2021
@agocke
Copy link
Member

agocke commented Aug 11, 2021

@mangod9 Is this the same problem as was fixed in #55032?

@agocke agocke modified the milestones: 6.0.0, 7.0.0 Aug 16, 2021
@agocke
Copy link
Member

agocke commented Jul 26, 2022

Assuming this was #55032

@agocke agocke closed this as completed Jul 26, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Aug 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

No branches or pull requests

4 participants