Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

newProxy doesn't seem to work #11

Closed
ericfu88 opened this Issue Jun 25, 2012 · 8 comments

Comments

Projects
None yet
2 participants
  1. Copy the following code into a file called test.js
  2. Run it by "node test.js"
  3. Observe crash with something like this:
    Invalid memory access of location 0xa rip=0x102fc9462

Platform tested: Mac OS 10.7.4

// ================================
var java = require("java");

var myProxy = java.newProxy('java.lang.Runnable', {
run: function () {
// This is actually run on the v8 thread and not the new java thread
console.log("hello from thread");
}
});
myProxy.ref();

var thread = java.newInstanceSync("java.lang.Thread", myProxy);
thread.start();

setTimeout(function() {
console.log("Timed out!");
}, 3000);

Owner

joeferner commented Jul 9, 2012

Which version of Java are you running

java -version

Can you also try running

# gdb --args node test.js
# run
# // after crash
# where

java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04-415-11M3635)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01-415, mixed mode)

Output from gdb:

(gdb) run
Starting program: /usr/local/bin/node test.js
Reading symbols for shared libraries ++++++++++............................................................................................................................ done
Reading symbols for shared libraries ... done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries ........... done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries . done
Invalid memory access of location 0xa rip=0x100042462

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x000000000000000a
0x0000000100042462 in v8::Array::Length ()

Owner

joeferner commented Jul 10, 2012

Were you able to run "where" after the crash in gdb?

(gdb) run
Starting program: /usr/local/bin/node test.js
Reading symbols for shared libraries ++++++++++............................................................................................................................ done
Reading symbols for shared libraries ... done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries ........... done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries . done
Invalid memory access of location 0xa rip=0x100042462

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x000000000000000a
0x0000000100042462 in v8::Array::Length ()
(gdb) where
#0 0x0000000100042462 in v8::Array::Length ()
#1 0x0000000125703695 in EIO_AfterCallJs (req=0x125500830) at java.cpp:632
#2 0x0000000100257d97 in uv__after_work ()
#3 0x000000010026dc36 in eio_finish ()
#4 0x000000010026d71b in etp_poll ()
#5 0x000000010026df0d in eio_poll ()
#6 0x00000001002637f2 in uv_eio_want_poll_notifier_cb ()
#7 0x0000000100253ad5 in uv__async ()
#8 0x0000000100268149 in ev_invoke_pending ()
#9 0x0000000100268ab4 in ev_run ()
#10 0x0000000100252bf3 in uv_run ()
#11 0x0000000100005d7f in node::Start ()
#12 0x0000000100001574 in start ()

joeferner added a commit that referenced this issue Jul 11, 2012

Owner

joeferner commented Jul 11, 2012

If you wouldn't mind can you grab the latest code (not npm) and try again. I just added a check for no arguments which I believe was causing the issue. Thanks for your help debugging the issue.

That fixed it. Thank you very much!

Owner

joeferner commented Jul 12, 2012

Great. I've published a new version v0.0.5.

@joeferner joeferner closed this Jul 12, 2012

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