Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

newProxy doesn't seem to work #11

Closed
ericfu88 opened this Issue · 8 comments

2 participants

@ericfu88

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);

@joeferner
Owner

Which version of Java are you running

java -version

Can you also try running

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

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)

@ericfu88

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 ()

@joeferner
Owner

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

@ericfu88

(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 joeferner referenced this issue from a commit
@joeferner fix for issue #11 8bf25ea
@joeferner
Owner

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.

@ericfu88

That fixed it. Thank you very much!

@joeferner
Owner

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

@joeferner joeferner closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.