dnx-coreclr dies without error on darwin/linux #2875

Closed
natemcmaster opened this Issue Sep 30, 2015 · 53 comments

Projects

None yet
@natemcmaster
Member

Using dnx-coreclr-darwin-x64.1.0.0-rc1-15779.

Executing dnx on OS X dies without producing output. It does not actually execute the command.

Using OS X 10.11.1 (beta).

screen shot 2015-09-30 at 1 50 39 pm

@BrennanConroy
Contributor

You need to brew install icu4c now

@natemcmaster
Member

Thanks @BrennanConroy. Yup that fixed it.

Invisible errors = bad UX. Can we display errors when missing native dependencies?

@BrennanConroy
Contributor
@moozzyk
Member
moozzyk commented Sep 30, 2015

@natemcmaster - can you see anything interesting if DNX_TRACE is set to 1? For fatal errors we always should display a message. dnx does not know about icu so it cannot fail. I guess in this case CoreClr failed to load. The thing I don't know whether there is a bug in our code and the message was not printed or there was an issue with CoreClr but they still returned the success code in which case we should report it to them.

@natemcmaster
Member
$ export DNX_TRACE=1
$ dnx
Loaded module: dnx.coreclr.dylib
Found export: CallApplicationMain
Unhandled Exception:
   Cannot print exception string because Exception.ToString() failed.
@natemcmaster
Member

@moozzyk Nothing about missing icu4u.

@natemcmaster
Member

Also, with DNX_TRACE=1, the return code is no longer 0.

$ echo $?
6
@moozzyk
Member
moozzyk commented Sep 30, 2015

Need to investigate:

  • why we don't print any error message (probably because we use a FAILED macro equivalent which only treats negative results as failed)
  • why the exit code is different when running with DNX_TRACE=1 than when running with DNX_TRACE not set
@moozzyk moozzyk reopened this Sep 30, 2015
@muratg
Member
muratg commented Oct 1, 2015

@danroth27 will be adding this to the documentation and release notes for Beta 8. However, we should make it discoverable with an informative error message as well.

@muratg muratg added this to the 1.0.0-rc1 milestone Oct 1, 2015
@IRooc
IRooc commented Oct 2, 2015

Hi on rc1-15779 on dnu restore and dnx kestrel I get the following output and it doesn't run with DNX_TRACE=1

testpc1:testproject testuser$ dnu restore
Loaded module: dnx.coreclr.dylib
Found export: CallApplicationMain
Information: [DomainManager] Using CoreCLR
testpc1:testproject testuser$

testpc1:testproject testuser$ dnx -p test/TestWeb/ kestrel
Loaded module: dnx.coreclr.dylib
Found export: CallApplicationMain
Information: [DomainManager] Using CoreCLR
testpc1:testproject testuser$

@muratg
Member
muratg commented Oct 2, 2015

@IRooc just tried it with 1.0.0-rc1-15779 coreclr x64 on a Mac, and dnu restore seems to work for me. Can you try it out with a small Console app?

@IRooc
IRooc commented Oct 2, 2015

It is on a mac, I'll try a small project later AFK currently. The mono dnu restore works fine though.

@anurse
Member
anurse commented Oct 2, 2015

I can repro this on OS X 10.11 (it does not seem to repro on 10.10 Yosemite, only on El Capitan).

We don't officially support 10.11 yet, but we can start investigating why it is failing now :).

@anurse
Member
anurse commented Oct 2, 2015

FYI, output with DNX_TRACE

› DNX_TRACE=1 dnx
Loaded module: dnx.coreclr.dylib
Found export: CallApplicationMain

Unhandled Exception:
   Cannot print exception string because Exception.ToString() failed.
› uname -a
Darwin zuse.local 15.0.0 Darwin Kernel Version 15.0.0: Wed Aug 26 16:57:32 PDT 2015; root:xnu-3247.1.106~1/RELEASE_X86_64 x86_64

/cc @moozzyk @BrennanConroy

@davidfowl
Member

ICU!

@anurse
Member
anurse commented Oct 2, 2015

oh GREAAAAAAAAAT

@Flavien
Flavien commented Oct 2, 2015

I got the same issue on Ubuntu when executing CoreCLR dnx from an unprivileged user: #2748

It exits without any error message. And I also haven't figured out why it doesn't work.

@anurse
Member
anurse commented Oct 2, 2015

What version of Ubuntu? We only support 14.04 at the moment.

@Flavien
Flavien commented Oct 2, 2015

This is 14.04 on Docker.

@natemcmaster natemcmaster changed the title from dnx-darwin-coreclr dies without error on OS X 10.11.1 to dnx-coreclr dies without error on darwin/linux Oct 2, 2015
@Prehistoricoder

I am getting the same behavior on Ubuntu 14.04.3. Followed the instructions on the "Getting Started with CoreCLR" page on the CoreCLR project's GitHub site, substituting the correct version numbers in for rc1. When I run either dnx or dnu, I get no output whatsoever. It just returns to the console as though it didn't do anything.

Finally, after finding this conversation, I tried "export DNX_TRACE=1" and ran dnx again. This time I got the "Cannot print exception string because Exception.ToString() failed." message. I really think this sort of message should be printed to the console by default if there is a fatal error in dnx.

With that error message in hand, I did:

sudo apt-get install icu-devtools

and now everything is working (as an unprivileged user). Is the need to install icu-devtools documented anywhere? The silent failing has been driving me nuts for a few days now, lol.

@muratg
Member
muratg commented Oct 9, 2015

@Prehistoricoder ICU install steps will be documented by the time we release Beta 8. cc @danroth27 @glennc

@Flavien Could you install ICU? sudo apt-get install libicu-dev should do it. Let us know if it continues to be an issue for you.

@natemcmaster Exit code discrepancy seems to be due to this CoreCLR issue Could you try it with the latest DNX?

Closing this bug, but if there are still issues, I'll re-open.

@muratg muratg closed this Oct 9, 2015
@Flavien
Flavien commented Oct 9, 2015

To give an update on my issue, I used export DNX_TRACE=1, and the issue was that the access to /dev/stdout was denied. I looked this up more, and it turns out to be a docker issue: opencontainers/runc#280

@natemcmaster
Member

@muratg Have we pulled the coreclr fix yet? Exit code discrepancy is still broken with 15844 15854.

image

@natemcmaster
Member

@danroth27 Can we include brew install icu4u (or it's non-brew equivalent) in beta8 docs for OSX?

@natemcmaster
Member

@anurse same doc I linked (just html not the rst source). icu4u is not mentioned.

@danroth27
Member

I'm making the doc changes now

@natemcmaster
Member

Thanks! 👍

@muratg
Member
muratg commented Oct 9, 2015

@natemcmaster we haven't pulled updated CoreCLR bits on the dev branch yet. You can try the latest Beta8 build from the test feed or aspnetrelease.

@natemcmaster
Member

@muratg just tested builds from the test beta8 and aspnetrelease feeds on OSX and Ubuntu 14.04. When ICU is missing, I still the same behavior. :-/ DNX_TRACE=0 has return code 0, DNX_TRACE=1 has return code 6.

@IRooc
IRooc commented Oct 9, 2015

On mac installed icu and no issues anymore.

@natemcmaster
Member

Yeah, missing ICU is the problem. To be clear, the issue now is the error code returned when ICU is missing. Without ICU and DNX_TRACE=0, dnx fails and returns errno 0. This is very misleading for scripting (e.g. testing, which is why we probably missed this in the first place).

@muratg muratg reopened this Oct 9, 2015
@muratg
Member
muratg commented Oct 9, 2015

Re-opening to keep this in the radar. If ICU ends up being statically linked in CoreCLR platform specific binaries, this won't be a problem anymore. Otherwise we may need to do something.

@muratg muratg modified the milestone: 1.0.0 backlog, 1.0.0-rc1 Oct 9, 2015
@jtbennett

Not sure whether this is the same problem, but after upgrading to beta8, dnx and dnu silently fail for me.

mbp-jtb:MyApp john$ dnvm list

Active Version              Runtime Architecture OperatingSystem Alias
------ -------              ------- ------------ --------------- -----
  *    1.0.0-beta8          coreclr x64          darwin          coreclr
       1.0.0-beta8          mono                 linux/osx       default

mbp-jtb:MyApp john$ dnu restore
mbp-jtb:MyApp john$ dnx kestrel
mbp-jtb:MyApp john$ export DNX_TRACE=1
mbp-jtb:MyApp john$ dnu restore
Loaded module: dnx.coreclr.dylib
Found export: CallApplicationMain

Unhandled Exception: 
   Cannot print exception string because Exception.ToString() failed.
mbp-jtb:MyApp john$ dnx kestrel
Loaded module: dnx.coreclr.dylib
Found export: CallApplicationMain

Unhandled Exception: 
   Cannot print exception string because Exception.ToString() failed.
@muratg
Member
muratg commented Oct 16, 2015

@jtbennett can you check if you have ICU installed with brew info icu4c? If you haven't installed it yet, you should install it with brew install icu4c.

@jtbennett

Thanks! That was it. After install, both dnu and dnx work as expected. Sorry I missed the instructions.

Is there an issue open for the Exception.ToString() problem?

@jrr
jrr commented Oct 20, 2015

brew install icu4c seems insufficient to resolve this on my El Capitan system:

] dnvm list

Active Version              Runtime Architecture OperatingSystem Alias
------ -------              ------- ------------ --------------- -----
  *    1.0.0-beta8          coreclr x64          darwin          default

jrr@jrrs-MacBook-Pro:~
] brew info icu4c
icu4c: stable 55.1, HEAD
C/C++ and Java libraries for Unicode and globalization
http://site.icu-project.org/

This formula is keg-only.
OS X provides libicucore.dylib (but nothing else).

/Users/jrr/.Homebrew/Cellar/icu4c/55.1 (244 files, 65M) *
  Built from source
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/icu4c.rb
==> Options
--c++11
    Build using C++11 mode
--universal
    Build a universal binary
--HEAD
    Install HEAD version
==> Caveats
This formula is keg-only, which means it was not symlinked into /Users/jrr/.Homebrew.

OS X provides libicucore.dylib (but nothing else).

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/Users/jrr/.Homebrew/opt/icu4c/lib
    CPPFLAGS: -I/Users/jrr/.Homebrew/opt/icu4c/include

jrr@jrrs-MacBook-Pro:~
] uname -a
Darwin jrrs-MacBook-Pro.local 15.0.0 Darwin Kernel Version 15.0.0: Wed Aug 26 16:57:32 PDT 2015; root:xnu-3247.1.106~1/RELEASE_X86_64 x86_64
jrr@jrrs-MacBook-Pro:~
] DNX_TRACE=1 dnx
Loaded module: dnx.coreclr.dylib
Found export: CallApplicationMain

Unhandled Exception:
   Cannot print exception string because Exception.ToString() failed.
jrr@jrrs-MacBook-Pro:~

I suspect this may relate to 1) my installation of Homebrew into ~/.homebrew instead of /usr/local, and/or 2) changes to dynamic loader behavior in OSX 10.11

Can anyone confirm that they have a working 1.0.0-beta8 on El Cap?

@natemcmaster
Member

@jrr I'm using OS X 10.11.1 Beta (El Cap). I suspect your issue is you have homebrew installing to /Users/jrr/.Homebrew/ rather than /usr/local/

@jrr
jrr commented Oct 20, 2015

@natemcmaster yep, that was it! Thanks.

@kaczasty

I'm getting the same error on Arch Linux even after installing ICU.

⇒  pacman -Qi icu
Name           : icu
Version        : 55.1-1
Description    : International Components for Unicode library
Architecture   : x86_64
URL            : http://www.icu-project.org/

(...)

⇒  dnx
Loaded module: dnx.coreclr.so
Found export: CallApplicationMain

Unhandled Exception: 
   Cannot print exception string because Exception.ToString() failed.

@moozzyk
Member
moozzyk commented Oct 24, 2015

@kaczasty - see this thread #3059 - looks like 55 and CoreClr are not compatible..

@kaczasty

After downgrading icu to ver 52 dnx works fine. Thanks!

@jiggak
jiggak commented Oct 25, 2015

@kaczasty After downgrading to icu 52 you'll find that several other packages in Arch will fail to work (chromium and nautilus to name two).

@kaczasty

@jiggak Yes, I'm aware of that. I wouldn't recommend anyone doing this unless you just want to play around with core clr.

@muratg
Member
muratg commented Oct 26, 2015

@ellismg What would be the ICU version required on Linux for the next CoreCLR?

@natemcmaster
Member

Probably been discussed before. But why not use static linking?

@ellismg
Contributor
ellismg commented Oct 26, 2015

It depends on what RID you install. The Ubuntu 14.04 one uses ICU-52

@LauriListak

This is also a problem on Ubuntu 15.10 with libicu-dev and icu-devtools installed, had to manually install libicu52 and then CoreCLR works.

@lnu
lnu commented Nov 19, 2015

Same issue on OpenSuse tumbleweed(libicu 55).

@ellismg
Contributor
ellismg commented Nov 19, 2015

As a work around, you can build your own copy of System.Globalization.Native.so from the CoreCLR (from source) and then replace the version in DNX with the one you built. This will link against your correct ICU and things should work.

Note that the ABI between the runtime and this library are under active development, so this should only be done for "well known" releases where you can find a stable copy of the CoreCLR sources that match up with what is in your DNX.

@lnu
lnu commented Nov 19, 2015

Should do the trick 👍
i'll give it a try
thanks

@muratg muratg modified the milestone: 1.0.0 backlog, Backlog Dec 11, 2015
@brendanjbaker

Just ran into this on Debian Stretch ("testing"). It uses libicu-dev version 55.1-7, which causes the behavior described above:

baker@wardenclyffe:~$ dnx
baker@wardenclyffe:~$ echo $?
0
baker@wardenclyffe:~$ export DNX_TRACE=1
baker@wardenclyffe:~$ dnx
Loaded module: dnx.coreclr.so
Found export: CallApplicationMain

Unhandled Exception: 
   Cannot print exception string because Exception.ToString() failed.
Aborted

I was able to hack things together into a working state by forcing the installation of libicu-dev version 52.1-8+deb8u3. I did this by adding Debian stable's security updates repository and manually selecting that version to install. Not a viable solution long-term, but if you want to get up and running today on the testing distribution, try this...

Add the following to /etc/apt/sources.list:

deb http://security.debian.org/ jessie/updates main
deb-src http://security.debian.org/ jessie/updates main

Then, manually select the old package to install:

apt-get install icu-devtools=52.1-8+deb8u3

Bingo, now things are working:

baker@wardenclyffe:~$ dnu
Microsoft .NET Development Utility CoreClr-x64-1.0.0-rc2-16357

Usage: dnu [options] [command]

Options:
  -v|--verbose  Show verbose output
  -?|-h|--help  Show help information
  --version     Show version information

Commands:
  build             Produce assemblies for the project in given directory
  clear-http-cache  Clears the package cache.
  commands          Commands related to managing application commands (install, uninstall)
  feeds             Commands related to managing package feeds currently in use
  install           Install the given dependency
  list              Print the dependencies of a given project
  pack              Build NuGet packages for the project in given directory
  packages          Commands related to managing local and remote packages folders
  publish           Publish application for deployment
  restore           Restore packages
  wrap              Wrap a csproj/assembly into a project.json, which can be referenced by project.json files

Use "dnu [command] --help" for more information about a command.

I'm not certain what the consequences are, if any, for engaging in this sort of package sorcery, so coder beware. Running apt-get update && apt-get upgrade unpacked the newer 55 version, but dnu and dnx kept working. Running dpkg-query -l seemed to indicate version 52 was living harmoniously alongside version 55:

baker@wardenclyffe:~$ dpkg-query -l | grep -i icu
ii  icu-devtools                          55.1-7                                 amd64        Development utilities for International Components for Unicode
ii  libharfbuzz-icu0:amd64                1.0.1-1+b1                             amd64        OpenType text shaping engine ICU backend
ii  libicu-dev:amd64                      55.1-7                                 amd64        Development files for International Components for Unicode
ii  libicu52:amd64                        52.1-8+deb8u3                          amd64        International Components for Unicode
ii  libicu55:amd64                        55.1-7                                 amd64        International Components for Unicode

If you run apt-get upgrade, it will suggest running apt autoremove to remove your libicu52. I'm not certain if there's a way to keep your version pegged at 52, or to instruct apt that you really do need version 52, etc.

@rtezli
rtezli commented Feb 5, 2016

@natemcmaster "Probably been discussed before. But why not use static linking?"

Would solve most of the issues. Also that dnx don't run out of the box on other Linux distributions than Ubuntu and I did not talk to anybody so far using Ubuntu on production.

You can try "ldd dnx" btw. to find which dependencies are missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment