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

Can't use edge with Node 0.12.7 and Mono 4.0.2 #305

Open
rudism opened this issue Aug 7, 2015 · 4 comments
Open

Can't use edge with Node 0.12.7 and Mono 4.0.2 #305

rudism opened this issue Aug 7, 2015 · 4 comments

Comments

@rudism
Copy link

@rudism rudism commented Aug 7, 2015

I'm on Arch Linux with Node, NPM, and Mono installed from the standard Arch repo, latest versions as of 8/7/15.

$ node --version
v0.12.7
$ npm --version
2.13.2
$ node-gyp --version
v2.0.2
$ mono --version
Mono JIT compiler version 4.0.2 (Stable 4.0.2.5/c99aa0c Mon Jul 13 18:57:35 UTC 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen

I have a very simple test project set up. Here is the package.json file:

{
  "name": "edge-test",
  "version": "1.0.0",
  "description": "testing edgejs",
  "dependencies": {
    "edge": "^0.10.1"
  }
}

Here is my app.js file:

console.log('before require');
var edge = require('edge');
console.log('after require');

There are no apparent problems when doing an npm install:

$ npm install
npm WARN package.json edge-test@1.0.0 No repository field.
npm WARN package.json edge-test@1.0.0 No README data
npm WARN package.json edge-test@1.0.0 No license field.
|
> edge@0.10.1 install /home/rudism/source/test-edge/node_modules/edge
> node tools/install.js

make: Entering directory '/home/rudism/source/test-edge/node_modules/edge/build'
  CXX(target) Release/obj.target/edge/src/mono/clractioncontext.o
  CXX(target) Release/obj.target/edge/src/mono/clrfunc.o
  CXX(target) Release/obj.target/edge/src/mono/clrfuncinvokecontext.o
  CXX(target) Release/obj.target/edge/src/mono/edge.o
  CXX(target) Release/obj.target/edge/src/mono/monoembedding.o
  CXX(target) Release/obj.target/edge/src/mono/task.o
  CXX(target) Release/obj.target/edge/src/mono/dictionary.o
  CXX(target) Release/obj.target/edge/src/mono/nodejsfunc.o
  CXX(target) Release/obj.target/edge/src/mono/nodejsfuncinvokecontext.o
  CXX(target) Release/obj.target/edge/src/mono/utils.o
  CXX(target) Release/obj.target/edge/src/common/v8synchronizationcontext.o
  SOLINK_MODULE(target) Release/obj.target/edge.node
  COPY Release/edge.node
  ACTION binding_gyp_build_managed_target_compile_mono_embed src/mono/monoembedding.exe
  TOUCH Release/obj.target/build_managed.stamp
make: Leaving directory '/home/rudism/source/test-edge/node_modules/edge/build'
edge@0.10.1 node_modules/edge
├── edge-cs@0.2.7
└── nan@1.9.0

However, running the app produces the following error:

$ node app.js
before require

Native stacktrace:

        /usr/lib/libmonoboehm-2.0.so.1(+0xd30ba) [0x7f86097750ba]
        /usr/lib/libmonoboehm-2.0.so.1(+0x48880) [0x7f86096ea880]
        /usr/lib/libpthread.so.0(+0x10660) [0x7f860c4ae660]
        /usr/lib/libmonoboehm-2.0.so.1(+0x243690) [0x7f86098e5690]
        /usr/lib/libmonoboehm-2.0.so.1(+0x24bb48) [0x7f86098edb48]
        /usr/lib/libmonoboehm-2.0.so.1(+0x244b8f) [0x7f86098e6b8f]
        /usr/lib/libmonoboehm-2.0.so.1(+0x243f58) [0x7f86098e5f58]
        /usr/lib/libmonoboehm-2.0.so.1(+0x23abb8) [0x7f86098dcbb8]
        /usr/lib/libmonoboehm-2.0.so.1(+0x23b4a1) [0x7f86098dd4a1]
        /usr/lib/libmonoboehm-2.0.so.1(+0x245aba) [0x7f86098e7aba]
        /usr/lib/libmonoboehm-2.0.so.1(+0x245bde) [0x7f86098e7bde]
        /usr/lib/libmonoboehm-2.0.so.1(+0x1fbd01) [0x7f860989dd01]
        /usr/lib/libmonoboehm-2.0.so.1(+0x1d03fc) [0x7f86098723fc]
        /usr/lib/libmonoboehm-2.0.so.1(+0x49b56) [0x7f86096ebb56]
        /home/rudism/source/test-edge/node_modules/edge/build/Release/edge.node(_ZN13MonoEmbedding10InitializeEv+0x81) [0x7f8609c410c1]
        /home/rudism/source/test-edge/node_modules/edge/build/Release/edge.node(_Z4initN2v86HandleINS_6ObjectEEE+0x47) [0x7f8609c40f97]
        node(_ZN4node6DLOpenERKN2v820FunctionCallbackInfoINS0_5ValueEEE+0x2dd) [0x96de7d]
        node(_ZN2v88internal25FunctionCallbackArguments4CallEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEE+0xaa) [0x5f3aaa]
        node() [0x610a69]
        [0x2202ecf0740e]

Debug info from gdb:

No threads.

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

Aborted (core dumped)

If there's any other information I can provide to help identify the cause of this problem, please let me know.

@khalidsalomao

This comment has been minimized.

Copy link

@khalidsalomao khalidsalomao commented Sep 1, 2015

Hi rudism,

I haven't used edge on linux yet, but I have some experience with mono on linux and there was a recent bug in mono that was fixed in kernel 3.13.0-54-generic.

This bug caused apps with threading to crash without explicit reason. So you could try to update your kernel! (It is a long shot... but could be it...)

Some references:
https://bugzilla.xamarin.com/show_bug.cgi?id=29299
http://askubuntu.com/questions/375844/kernel-downgrade-after-update-broke-my-system

@rudism

This comment has been minimized.

Copy link
Author

@rudism rudism commented Sep 1, 2015

I'm not sure that's it. The Arch machine I'm reproducing it on is up to kernel 4.1.6, but I have a Centos7 box on kernel 3.10.0 where edge is working just fine. I thought at first it might be related to the node version, but it looks like they're both on 0.12.7 now and still only the one works.

Mono in general on my Arch system is stable (I'm neck-deep in it all day long every day for work), there's just something strange going on that breaks edge.

(I should note that I have two independant Arch machines and this problem occurs on both of them, so it's probably not something I specifically broke in my particular environment.)

@tjanczuk

This comment has been minimized.

Copy link
Owner

@tjanczuk tjanczuk commented Sep 25, 2015

Support for Node.js 4.x just shipped (edge@4.0.0). It runs on Mono 4.0.4.1. Does this fix your issue?

@JPMenezes

This comment has been minimized.

Copy link

@JPMenezes JPMenezes commented Jul 20, 2017

Hi Tomasz,

I'm having this same problem on Arch Linux:
node v8.1.4
(had to apply this fix: #559)
kernel 4.11.9
mono 5.0.0

Any suggestion/fix for this?

Thank you.

EDIT:
So I tried the Docker image and it works. I also tried creating the Docker image by myself with the Dockerfile but I had (SIGSEGV) problems so I started testing multiple combinations of edge, mono and node.

My conclusions are:

  • node is not the problem. 8.2.0 is the latest version on Arch and is working fine.
  • edge must be installed ("npm install edge") with mono 4.6.1.3 but I can install 4.8.0.495 afterwards and use DLLs compiled with it. mono 5.0.0, the latest version on Arch, is not an option yet. Note: I downloaded the "old" mono packages for Arch from https://archive.archlinux.org/packages/m/mono/
  • "npm install edge" fails and the manual fix (#559) is required. This means that after running "npm install edge" the project.csproj file must be placed on the lib/bootstrap/ folder and edge installation must be continued manually with "node tools/install.js"

The following steps should work for an Arch Linux user, assuming the existence of a project.csproj file on ~/edge folder with the contents of the Project element as described by https://github.com/CzBuCHi (here: #559):

sudo pacman -U ~/Downloads/mono-4.6.1.3-1-x86_64.pkg.tar.xz
npm install edge
cd node_modules/edge
cp ~/edge/project.csproj lib/bootstrap/
sudo pacman -U ~/Downloads/mono-4.8.0.495-1-x86_64.pkg.tar.xz
node tools/install.js
cd samples/
node 101_hello_lambda.js

Compiling the Sample105.cs file and running the 105_add7_dll.js sample that "edges" the generated DLL file also work:

curl https://raw.githubusercontent.com/tjanczuk/edge/master/samples/Sample105.cs > Sample105.cs
mcs -sdk:4.5 Sample105.cs -target:library
node 105_add7_dll.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.