dalevross
dalevross

Reputation: 522

Unable to find an entry point named 'SystemNative_GetSocketAddressSizes' in shared library 'libSystem.Native'. with .NET 8

I am attempting to use .NET 8 on Ubuntu to host a .NET Core application. When I run dotnet --version on the server I get 8.0.107 on the development Windows Machine it is 8.0.400-preview.0.24324.5

The app is built using a task in Azure Devops as follows, then scp-ed to the server

- task: DotNetCoreCLI@2
  inputs:
    command: 'publish'
    publishWebProjects: true
    arguments: '-c Release --runtime linux-x64 -o amnathrig-dev'
    zipAfterPublish: false
    modifyOutputPath: false

And configured to run using a Kestrel Service configured as follows

[Unit]
Description=Amnathrig Dev

[Service]
WorkingDirectory=/var/www/amnathrig-dev
ExecStart=/usr/bin/dotnet /var/www/amnathrig-dev/amnathrig.dll
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=amnathrig-dev
User=ubuntu
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment="ASPNETCORE_URLS=http://localhost:3142"

[Install]
WantedBy=multi-user.target

The app crashes with a core dump according to the service status and when I run sudo systemctl status kestrel-amnathrig-dev.service

I noticed an exception was thrown with the following text

Hosting failed to start
System.IO.IOException: Failed to bind to address http://localhost:3142.
---> System.AggregateException: One or more errors occurred. (The type initializer for 'System.Net.SocketAddress' threw an exception.) (The type initialize>
---> System.TypeInitializationException: The type initializer for 'System.Net.SocketAddress' threw an exception.
---> System.TypeInitializationException: The type initializer for 'System.Net.SocketAddressPal' threw an exception.
---> System.EntryPointNotFoundException: Unable to find an entry point named 'SystemNative_GetSocketAddressSizes' in shared library 'libSystem.Native'.

Both ChatGPT and Github Copilot indicate a potential conflict with the runtime versions.

I expected a the app to run as it does locally with version 8, and remotely on a Oracle Linux server with version 6

Edited 7/15/2024

I added the following task to the build pipeline based on some research I did but I'm not sure it's still necessary based on the latest images being used.

- task: UseDotNet@2
  displayName: 'Install .NET Core SDK'
  inputs:
    version: 8.x
    performMultiLevelLookup: true

After doing that and checking the most recent logs from journalctl for the service, I see the following.

Jul 15 19:02:27 amnathrig systemd[1]: kestrel-amnathrig-dev.service: Scheduled restart job, restart counter is at 15.
Jul 15 19:02:27 amnathrig systemd[1]: Stopped Amnathrig Dev.
Jul 15 19:02:27 amnathrig systemd[1]: Started Amnathrig Dev.
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]: Unhandled exception. System.TypeInitializationException: The type initializer for 'System.Threading.Thread' threw an exception.
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:  ---> System.EntryPointNotFoundException: Unable to find an entry point named 'SystemNative_SchedGetCpu' in shared library 'libSystem.Native'.
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at System.Threading.ProcessorIdCache.ProcessorNumberSpeedCheck()
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at System.Threading.Thread..cctor()
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    --- End of inner exception stack trace ---
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at System.Threading.ExecutionContext.Capture()
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at System.Threading.Tasks.Task..ctor(Delegate action, Object state, Task parent, CancellationToken cancellationToken, TaskCreationOptions creationOptions, In>
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at System.Threading.Tasks.Task.InternalStartNew(Task creatingTask, Delegate action, Object state, CancellationToken cancellationToken, TaskScheduler schedule>
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at System.Threading.Tasks.TaskFactory.StartNew(Action`1 action, Object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskS>
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.CancelToken(ChangeTokenInfo matchInfo)
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.ReportChangeForMatchedEntries(String path)
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.OnError(Object sender, ErrorEventArgs e)
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName)
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at System.IO.FileSystemWatcher.StartRaisingEvents()
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.TryEnableFileSystemWatcher()
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.CreateFileChangeToken(String filter)
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at Microsoft.Extensions.Primitives.ChangeToken.ChangeTokenRegistration`1..ctor(Func`1 changeTokenProducer, Action`1 changeTokenConsumer, TState state)
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func`1 changeTokenProducer, Action changeTokenConsumer)
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at Microsoft.Extensions.Configuration.FileConfigurationProvider..ctor(FileConfigurationSource source)
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at Microsoft.Extensions.Configuration.Json.JsonConfigurationSource.Build(IConfigurationBuilder builder)
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at Microsoft.Extensions.Configuration.ConfigurationManager.AddSource(IConfigurationSource source)
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at Microsoft.Extensions.Configuration.ConfigurationManager.Microsoft.Extensions.Configuration.IConfigurationBuilder.Add(IConfigurationSource source)
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at Microsoft.Extensions.Hosting.HostingHostBuilderExtensions.ApplyDefaultAppConfiguration(HostBuilderContext hostingContext, IConfigurationBuilder appConfigB>
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at Microsoft.Extensions.Hosting.HostApplicationBuilder..ctor(HostApplicationBuilderSettings settings)
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at Microsoft.AspNetCore.Builder.WebApplicationBuilder..ctor(WebApplicationOptions options, Action`1 configureDefaults)
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at Microsoft.AspNetCore.Builder.WebApplication.CreateBuilder(String[] args)
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at Program.<Main>$(String[] args)
Jul 15 19:02:27 amnathrig systemd[1]: kestrel-amnathrig-dev.service: Main process exited, code=dumped, status=6/ABRT
Jul 15 19:02:27 amnathrig systemd[1]: kestrel-amnathrig-dev.service: Failed with result 'core-dump'.

The error seems to be in the same shared library

Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:  ---> System.EntryPointNotFoundException: Unable to find an entry point named 'SystemNative_SchedGetCpu' in shared library 'libSystem.Native'.
Jul 15 19:02:27 amnathrig amnathrig-dev[156470]:    at System.Threading.ProcessorIdCache.ProcessorNumberSpeedCheck()

Upvotes: 0

Views: 184

Answers (0)

Related Questions