cheery / node-udev

Bindings to libudev
35 stars 31 forks source link

Assertion `handle->InternalFieldCount() > 0' failed. #5

Closed birdca closed 9 years ago

birdca commented 9 years ago

It works fine while I use the how-to-use example after npm install udev, but will meet error like void node::ObjectWrap::Wrap(v8::Handle<v8::Object>): Assertionhandle->InternalFieldCount() > 0' failed. Aborted (core dumped) after clone source code,npm i` and node the example.

OS: Ubuntu 14.04 64bits nodejs: 1.2.0 npm: 2.5.1 libudev1: 204-5ubuntu20.11

cheery commented 9 years ago

I may have forgotten to update the npmjs, but if it's related to recent changes, it would break when I republish.

Did you typo the nodejs: 1.2.0? I thought the newest is 0.12.4.

cheery commented 9 years ago

I don't manage to reproduce the error. Also I just compared the tarball and the git repository.

The major difference is this in package.json:

<     "nan": "~1.7.0"
---
>     "nan": "~1.8.4"

I bumped the version in npmjs to get them match. But this doesn't solve this problem. If it's a problem resulting from something else than installation, then I don't know how it can happen, because the code sets InternalFieldCount to 1 before the only Wrap present in the code can be entered.

birdca commented 9 years ago

Yeah, it might be typo, but I can't reconfirm it now.

Same error on different computer: OS: Ubuntu 14.04 64bits nodejs: 0.10.38 npm: 1.4.28 libudev1: 204-5ubuntu20.12 I think it's not a installation problem. That's okay, I'll try to figure it out~ Thank u!

birdca commented 9 years ago

Oooops! It was my mistake, sorry... After I change var udev = require('./build/Release/udev'); to var udev = require("./udev"); in my test, it works!! I totally forgot that it'll show "Cannot find module 'udev'" in example, so I changed var udev = require("udev"); to var udev = require('./build/Release/udev');, really sorry about that! :p

cheery commented 9 years ago

Why did that cause to abort on assertion rather than crash properly? Also can you think of a modification into the program that'd have prevented this mistake? After all it took you 3 days to figure it out.

I already know one possible way, but you might know better one.

birdca commented 9 years ago

M.. it's a tough question, actually I'm new to js (only 1 month), could you show me some tips?

cheery commented 9 years ago

Actually I think these simple modifications would have helped: