core dump

155 views
Skip to first unread message

Matt Walters

unread,
Jun 6, 2014, 6:44:51 PM6/6/14
to node...@googlegroups.com
Hi guys,

I'm using a proxy to allow Java to call back out to Node. After a short period of running, Java crashes and core dumps. I'm calling ref() on my object to ensure it's not GC'd. 

Any ideas as to what may be occurring? Are there idiosyncrasies of JNI that I need to be aware of?

Here are the relevant parts of code:

JavaScript:

var Log = java.import('bla.trace.Log');
var logger = java.newProxy('bla.trace.Logger', {
  emit: function (message) {
    console.log(message);
  }
});

setInterval(function () {
  logger.ref();
}, 1000); 

Log.setLoggerSync(logger); 

/// kick off some code that will cause Java code to execute, calling Logger.emit() to fire off from time to time.  

Java: 

package bla.trace;

public interface Logger {
  void emit(String message);
}

/**next file**/ 
 
package bla.trace;

public class Log {

  private Logger logger;

  /* to use this class, pass a dynamic proxy from Nodejs which
      defines an emit callback function (  function (message) { }  )
  */
  public static void setLogger(Logger logger) {
    INSTANCE.logger = logger;
  }

  public static void unsetLogger() {
    INSTANCE.logger = null;
  }

  private static final Log INSTANCE = new Log();

  public static void trace(String message) {
    INSTANCE.emit(message);
  }

  private void emit(String message) {
    if (this.logger != null ) {
      this.logger.emit(message);
    }
  }
}

Dump error:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (safepoint.cpp:717), pid=21655, tid=1287
#  fatal error: Illegal threadstate encountered: 4
#
# JRE version: Java(TM) SE Runtime Environment (7.0_55-b13) (build 1.7.0_55-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.55-b03 mixed mode bsd-amd64 compressed oops)
# Core dump written. Default location: /cores/core or core.21655
#
# An error report file with more information is saved as:
# /Users/matt/development/bla/lib-node-pricing/hs_err_pid21655.log
#
# If you would like to submit a bug report, please visit:
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
[1]    21653 abort (core dumped)  mocha test/csv/csv.js 

Happy to send along a copy of the core dump if anyone wants to see it. 

Thanks for the help!

Matt

Joe Ferner

unread,
Jun 9, 2014, 9:29:00 AM6/9/14
to node...@googlegroups.com
I haven't tested the proxy code as well as I could. Is there any particular spot it happens in?

I can try taking a look at your dump file but I haven't had a lot of success tracking things down that way because of variations in the binary files.

Alternatively, could you run...

gdb --args `which node` <your node program>  (then type run, then when you have an error type where)

Then send me the stack trace.

Matt Walters

unread,
Jun 9, 2014, 5:31:32 PM6/9/14
to node...@googlegroups.com
I've attached a couple of dump files. Hopefully they're helpful! 

gdb hasn't been of much help. Do you know how to load either the Java or node-java C++ symbols to turn the following into a readable stacktrace?

Program received signal SIGABRT, Aborted.
0x00007fff92fe5866 in ?? ()
(gdb) where
#0  0x00007fff92fe5866 in ?? ()
#1  0x00007fff96c9c35c in ?? ()
#2  0x0000000000000000 in ?? ()

Thanks for your help!
hs_err_pid7813.log
hs_err_pid15148.log

Matt Walters

unread,
Jun 11, 2014, 11:58:42 AM6/11/14
to node...@googlegroups.com
Hi Joe,

I went ahead and created a sample project that illustrates the error I'm receiving: https://github.com/mateodelnorte/node-java-proxy-test

Would you mind cloning and taking a look? Just run 'npm install && node index.js' once you're in the directory. 

For comparison, the error I get is: 

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (safepoint.cpp:717), pid=89928, tid=1287
#  fatal error: Illegal threadstate encountered: 4
#
# JRE version: Java(TM) SE Runtime Environment (7.0_55-b13) (build 1.7.0_55-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.55-b03 mixed mode bsd-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/matt/development/scratch/node-java-proxy-test/hs_err_pid89928.log
#
# If you would like to submit a bug report, please visit:
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
[1]    89928 abort      node index.js

Thanks!

Matt 

Joe Ferner

unread,
Jun 20, 2014, 1:53:15 PM6/20/14
to node...@googlegroups.com
I finally had some time to look at this problem in depth. It was really hard to track down what was happening.

Can you grab the latest node-java from github and try running your example with it. I was able to run for 5+ minutes (then I stopped it without incident).

You can remove the call to "ref", only a call to unref is needed if you are done with the proxy.

Joe
Reply all
Reply to author
Forward
0 new messages