sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Failed to initialize CoreCLR, HRESULT: 0x80004005

Open prafullbhosale opened this issue 10 years ago • 61 comments

I have a project with a tool defined in the project.json's "tools" key. dotnet restore is able to find the tool and restore it succesfully.

However when I try to invoke the tool, I get the error:

Failed to initialize CoreCLR, HRESULT: 0x80004005

What am I missing here?

prafullbhosale avatar Feb 19 '16 02:02 prafullbhosale

Does your environment have a DOTNET_HOME directory set? Does this repro without it? What is the associated dotnet --version?

TheRealPiotrP avatar Feb 22 '16 07:02 TheRealPiotrP

#I got the same erro on CentOS6.5 .I updated my glibc & gcc. And i got the Binaries of Cli from #https://github.com/dotnet/cli and added it to the PATH. But when i run 'dotnet',it shows 'Failed to #initialize CoreCLR, HRESULT: 0x80131500' #please help...

[root@Cent65-Core down]# mkdir demo [root@Cent65-Core down]# cd demo/ [root@Cent65-Core demo]# dotnet new Failed to initialize CoreCLR, HRESULT: 0x80131500 [root@Cent65-Core demo]# dotnet Failed to initialize CoreCLR, HRESULT: 0x80131500 [root@Cent65-Core demo]# dotnet -version Failed to initialize CoreCLR, HRESULT: 0x80131500

#And my dnx run faild.It has any info. I'm sure it is running ,but something wrong and it's dropped out..

[root@Cent65-Core demo]# dnvm list

Active Version Runtime Architecture OperatingSystem Alias


  • 1.0.0-rc1-update1 coreclr x64 linux default

#Created a 'project.json' & 'Program.cs' manual . Then...↓ [root@Cent65-Core demo]# dnu restore #nothing happend..↑ [root@Cent65-Core demo]# dnx run #nothing happend..↑

EncoderPtd avatar Feb 23 '16 02:02 EncoderPtd

@piotrpMSFT I don't have this issue anymore with dotnet cli 1.0.0-beta-001489.

With the earlier version, I did try with and without dotnet_home env variable and still had the issue

The only thing I observed (though I am not sure that it could be the cause) was that the tool was built with using older dotnet-cli version (a day older) than what the project was built with.

I will try to see if I can get this to repro again.

prafullbhosale avatar Feb 23 '16 18:02 prafullbhosale

I can repro. I used this Dockerfile: https://raw.githubusercontent.com/colemickens/polykube/dev/dotnet/dockerfiles/aspnet-base/Dockerfile

Cloned aspnet/cli-samples.

Ran dotnet restore and COREHOST_TRACE=1 dotnet run: https://gist.github.com/colemickens/133e434131961e6fe28178a35ed03696

Failed to initialize CoreCLR, HRESULT: 0x80004005

dotnet version: dotnet-dev-1.0.0-beta-002111"

colemickens avatar Mar 30 '16 06:03 colemickens

Try yum install icu

hstarorg avatar Apr 09 '16 01:04 hstarorg

I seem to be getting this error too with the RC2/preview1 build on Windows. Not sure if this has anything to do with it, but I used xcopy to replace my versions of mscorlib.dll and mscorlib.ni.dll as I am attempting to measure the perf impact of some changes to coreclr.

Here is the output with COREHOST_TRACE=1: https://gist.github.com/anonymous/5f1ea6c1161a1850fc84cdabcef07f02

edit: Yep, my intuition was correct. I don't get this error if I don't overwrite the mscorlib.dll in the publish dir with my copy.

jamesqo avatar May 14 '16 02:05 jamesqo

I just installed on Ubuntu 16.04 using the directions at https://www.microsoft.com/net/core#ubuntu except I dropped it in /opt/dotnet instead of ~/dotnet.

justinjstark@X230:~/test$ dotnet
Usage: dotnet [--help | app.dll]
justinjstark@X230:~/test$ dotnet --version
Failed to initialize CoreCLR, HRESULT: 0x80131500
justinjstark@X230:~/test$ dotnet --help
Failed to initialize CoreCLR, HRESULT: 0x80131500
justinjstark@X230:~/test$ dotnet new
Failed to initialize CoreCLR, HRESULT: 0x80131500

justinjstark avatar May 17 '16 00:05 justinjstark

Xenial isn't supported yet. https://github.com/dotnet/cli/issues/2957

colemickens avatar May 17 '16 01:05 colemickens

@colemickens Got it. Thanks.

justinjstark avatar May 17 '16 01:05 justinjstark

This does not seem to be an issue anymore.

livarcocc avatar Jul 15 '16 22:07 livarcocc

I don't know why this is closed, because .NET Core stability is some kind of a joke.

http://pastebin.com/raw/tdSdXDKa

I have to issue dotnet run command 37 TIMES before it actually works. THIRTY SEVEN GODDAMN TIMES OR MORE!

kamilosxd678 avatar Nov 02 '16 17:11 kamilosxd678

I tried all RTM versions on my Debian 8.6 (jessie) server, but my pre-compiled ASP.NET Core MVC webapp failed with this exact error.

My webapp is running as a systemd service unit that call dotnet my.dll --server.urls http://localhost:xxxx with specific environment variables, and systemd is constantly trying to run and rerun the unit that fail constantly.

After several tries, sometimes, the webapp pass the startup initialization, but on first web client request an OutOfMemoryException is thrown, related to the lambda expression compiler used by entityframework apis.

This error, Failed to initialize CoreCLR, seems to be related to OutOfMemoryException exceptions.

Actually, this server has 4GB of RAM. On another server using Ubuntu Server LTS, with 8GB of RAM, no exceptions. The webapp run fine.

On both server, when I use htop command, dotnet process has allocated 18.6GB of virtual memory for each child process. I'm not a linux specialist, especially with virtual memory, but is it really normal ?

htop

geeooff avatar Nov 22 '16 18:11 geeooff

Reopening as there is obviously another issue here. @schellap @gkhanna79 can you guys take a look at these OOMs? What data do we need to make this experience better?

TheRealPiotrP avatar Nov 23 '16 08:11 TheRealPiotrP

@geeooff Is this a deterministic repro on Debian8.6? If so, can you please share the steps to setup a repro at our end? This will enable @kouvel to take a look at this further.

Also, if the repro is deterministic, have you had a chance to run it under gdb/lldb and break at when exception is thrown? If so, can you please share that dump or callstack?

CC @janvorli

gkhanna79 avatar Nov 23 '16 14:11 gkhanna79

@kamilosxd678 I've just seen your previous post, I am sorry for missing it when you have posted it few weeks ago. What is the hardware configuration of your machine? Getting Failed to initialize CoreCLR, HRESULT: 0x80004005 means that the initialization has failed at very early stages and I have always seen this error in the past when there was a mismatch between the libcoreclr.so and mscorlib.dll / mscorlib.ni.dl / System.Private.CorLib.dll / System.Private.ni.CorLib.dll - e.g. they weren't built from the exactly the same sources or libcoreclr.so was debug build and the other libs release or vice versa. Have you built coreclr yourself or have you used a dotnet cli package that you've downloaded untouched?

janvorli avatar Nov 23 '16 15:11 janvorli

@janvorli I have basically bare-bone installation from https://www.microsoft.com/net/core#linuxdebian this tutorial. Even basic example hello world app has these problems and my server is not some weak virtual machine but middle-grade dedicated server (32 GB RAM, Xeon E5, SSD drive) and I still have problems with it. I would agree that this is strictly bad installation problem, but it works randomly after throwing 0x80004005 and Out of memory messages.

kamilosxd678 avatar Nov 23 '16 15:11 kamilosxd678

@kamilosxd678 the out of memory is really strange on a machine with so much memory. Is it possible that you have cgroups installed and that it limits the amount of memory available for the .NET SDK? Anyways, would you be willing to run the dotnet run in a little different way and under strace and get me the log when it fails? I may be able to dig the real culprit from that.

What I would need is the output of: strace dotnet exec bin/Debug/netcoreapp1.0/WebApplication2.dll

janvorli avatar Nov 23 '16 18:11 janvorli

I have seen something similar before https://github.com/dotnet/cli/issues/652, with the server GC switch. Could you also try toggling the GC to be server or not in the project file? Or in the runtimeconfig.json.

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": false
    }
  },

schellap avatar Nov 23 '16 18:11 schellap

@janvorli Here it is http://cx453.net/download/strace.log

@schellap Whoah! It helped! It seems to be working now. Thank you

kamilosxd678 avatar Nov 23 '16 18:11 kamilosxd678

@gkhanna79 I will try to build another public project to test, this one is just too big to reproduce, and source code can't be shared unfortunately. For the moment, my app was built on a VSTS Build Server (Azure Hosted Agent) using dotnet publish -c release command. Technically this is the only .NET Core project this machine had launched. Can this be related to Debian vs Ubuntu differences ? On my test laptop using Ubuntu, I didn't had problem too. I don't have any other Debian distro to test, unfortunately.

@janvorli This server is using the latest binaries available at www.microsoft.com/net/core#linuxdebian, like @kamilosxd678 used. I will try to produce a trace too.

@schellap I will try this too. Thanks.

geeooff avatar Nov 23 '16 19:11 geeooff