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

Every Other "dotnet run" command fails with libhostpolicy.so error #7374

Closed
caleblloyd opened this issue Dec 16, 2016 · 16 comments
Closed

Every Other "dotnet run" command fails with libhostpolicy.so error #7374

caleblloyd opened this issue Dec 16, 2016 · 16 comments

Comments

@caleblloyd
Copy link

Steps to reproduce

I recently transitioned a .NET core project.json project to msbuild. dotnet watch run -c Docker used to work fine, but now half of the time it encounters an error.

Expected behavior

App should rebuild and run every time

Actual behavior

Half of the time the app builds and runs properly. The other half of the time, the app fails with the error A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/dotnet/app/bin/Docker/netcoreapp1.1'. Note that I was just adding a space when updating the app.csproj file to trigger a rebuild.

[DotNetWatcher] info: File changed: /dotnet/app/app.csproj
[DotNetWatcher] info: Running dotnet with the following arguments: run -c Docker
[DotNetWatcher] info: dotnet process id: 11514
A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/dotnet/app/bin/Docker/netcoreapp1.1'.
[DotNetWatcher] fail: dotnet exit code: 131
[DotNetWatcher] info: Waiting for a file to change before restarting dotnet...
[DotNetWatcher] info: Running dotnet with the following arguments: run -c Docker
[DotNetWatcher] info: dotnet process id: 11993
Hosting environment: Production
Content root path: /dotnet/app
Now listening on: http://*:5000
Application started. Press Ctrl+C to shut down.
Application is shutting down...
[DotNetWatcher] info: dotnet exit code: 0
[DotNetWatcher] info: File changed: /dotnet/app/app.csproj
[DotNetWatcher] info: Running dotnet with the following arguments: run -c Docker
[DotNetWatcher] info: dotnet process id: 12459
A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/dotnet/app/bin/Docker/netcoreapp1.1'.
[DotNetWatcher] fail: dotnet exit code: 131
[DotNetWatcher] info: Waiting for a file to change before restarting dotnet...

Environment data

$ dotnet --info
.NET Command Line Tools (1.0.0-preview4-004233)

Product Information:
Version:            1.0.0-preview4-004233
Commit SHA-1 hash:  8cec61c6f7

Runtime Environment:
OS Name:     ubuntu
OS Version:  16.04
OS Platform: Linux
RID:         ubuntu.16.04-x64
Base Path:   /usr/share/dotnet/sdk/1.0.0-preview4-004233
@caleblloyd
Copy link
Author

Not sure that it matters, but when it does succeed, I see app.runtimeconfig.dev.json and app.runtimeconfig.json in the bin/Debug/netcoreapp1.1/ directory. When it fails, those files are not there.

# Success

docker@cd9c5a4275aa:/dotnet/app$ dotnet run                 
Hosting environment: Production
Content root path: /dotnet/app
Now listening on: http://*:5000
Application started. Press Ctrl+C to shut down.
^CApplication is shutting down...

docker@cd9c5a4275aa:/dotnet/app$ ls bin/Debug/netcoreapp1.1/
app.deps.json  app.dll  app.pdb  app.runtimeconfig.dev.json  app.runtimeconfig.json  Microsoft.DiaSymReader.Native.amd64.dll  Microsoft.DiaSymReader.Native.x86.dll  xml.dll  xml.pdb


# Fail

docker@cd9c5a4275aa:/dotnet/app$ dotnet run                 
A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/dotnet/app/bin/Debug/netcoreapp1.1'.

docker@cd9c5a4275aa:/dotnet/app$ ls bin/Debug/netcoreapp1.1/
app.deps.json  app.dll  app.pdb  Microsoft.DiaSymReader.Native.amd64.dll  Microsoft.DiaSymReader.Native.x86.dll  xml.dll  xml.pdb
docker@cd9c5a4275aa:/dotnet/app$

@caleblloyd
Copy link
Author

I have a file called runtimeconfig.template.json in the base of my Console Application:

{
    "configProperties": {
        "System.GC.Server": true,
        "System.GC.Concurrent": true,
        "System.Threading.ThreadPool.MinThreads": 32
    }
}

If I delete this file, the error goes away. Am I supposed to move away from using runtimeconfig.template.json in MSBuild? If so, how do I represent these configurations in MSBuild?

@livarcocc
Copy link
Contributor

@nguerrera This seems like an SDK issue. I think you guys may have an issue for this already, even.

@TheRealPiotrP
Copy link
Contributor

Yea, I recall this getting fixed in the SDK but I'm not sure if we have the fix in preview5 CLI yet. We are using 1.0.0-alpha-20161104-2. @nguerrera @dsplaisted do we need to take a newer sdk for this fix?

@TheRealPiotrP
Copy link
Contributor

I added links to the SDK issues in #7188. Looks like they're not both fixed at this point so we'll need to wait a bit.

prafullbhosale referenced this issue in dotnet/Scaffolding Dec 20, 2016
Workaround for dotnet/cli/issues/5059
@TheRealPiotrP
Copy link
Contributor

@caleblloyd latest preview5 builds should have the necessary fixes. Can you give this a shot?

@caleblloyd
Copy link
Author

I can, can you point me to the Ubuntu 16.04 .deb files for preview5?

@livarcocc
Copy link
Contributor

Can you try this one: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/1.0.0-preview5-004422/dotnet-sdk-ubuntu.16.04-x64.1.0.0-preview5-004422.deb?

@caleblloyd
Copy link
Author

caleblloyd commented Jan 13, 2017

Fix confirmed in the preview5 link posted above. Thanks!

@armartinez
Copy link

@livarcocc Is there a version for MacOS, I'm getting this error using Preview 4 SDK

@livarcocc
Copy link
Contributor

You can simply get the latest from github.com/dotnet/cli.

But you can get it here as well, though on the page above it will be a newer version: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/1.0.0-preview5-004422/dotnet-dev-osx-x64.1.0.0-preview5-004422.pkg.

@armartinez
Copy link

Ok i though the latest was the preview 4 since all the links point to that but the one from the link you shared worked fine, thanks!

@bangonkali
Copy link

Awesome. I encountered this issue today. Preview 5 fixed it.

Had to run:

dotnet clean && dotnet restore && dotnet build && dotnet test

After installing the deb file.

@bangonkali
Copy link

Hi @livarcocc . Where are you getting the download link you're referring on https://github.com/dotnet/cli/issues/5059#issuecomment-275155418 and https://github.com/dotnet/cli/issues/5059#issuecomment-271368022? I checked on github.com/dotnet/cli it's only mentioning about preview 4.

@TheRealPiotrP
Copy link
Contributor

@bangonkali https://github.com/dotnet/cli is listing links to RC4. This is the latest version [preview1-preview5, then RC3-RC4]. Sorry about the confusion.

@GapiSla
Copy link

GapiSla commented Feb 27, 2017

had the same issues. I created .NET Core Web Application from VS2015 template and used publish to folder. When I ran publish output content on ubuntu 16.04 manually using "dotnet" I got the error. Fixed it by changing the project.json dependency for Microsoft.NETCoreApp, from this:

"Microsoft.NETCore.App": "1.1.0",

to this:

"Microsoft.NETCore.App": {
  "version": "1.1.0",
  "type": "platform"
},

The platform type added the runtimes directory to publish package.

CLI version: 1.0.0-preview2-1-003177

@msftgits msftgits transferred this issue from dotnet/cli Jan 31, 2020
@msftgits msftgits added this to the 1.0.0-preview5 milestone Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants