node-java icon indicating copy to clipboard operation
node-java copied to clipboard

lib/nodeJavaBridge.js hangs on Kubuntu 20.10, OpenJDK 15. Panic, can't revert!

Open coderextreme opened this issue 4 years ago • 10 comments

var java = require("java");

Hangs with version 0.12.2. Reverting to 0.12.1 for now. Please patch quickly as this is hanging up everything.

coderextreme avatar Jul 24 '21 02:07 coderextreme

node lib/nodeJavaBridge.js in the node-java folder hangs.

I can't seem to revert to 0.12.1. Help!

John

coderextreme avatar Jul 24 '21 02:07 coderextreme

I'm on Kubuntu 20.10 and I tried removing python. Oops.

John

coderextreme avatar Jul 24 '21 02:07 coderextreme

Reinstalling packages that were removed did not fix hanging problems.

$ node nodeJavaBridge.js

hangs

coderextreme avatar Jul 24 '21 03:07 coderextreme

This program shows the hanging problem:

'use strict';

process.env.PATH += require('../build/jvm_dll_path.json');

var path = require('path');
var binaryPath = null;
if (!binaryPath) {
  binaryPath = path.resolve(path.join(__dirname, "../build/Release/nodejavabridge_bindings.node"));
}
var bindings = require(binaryPath);

coderextreme avatar Jul 24 '21 03:07 coderextreme

Was able to successfully revert to 0.12.1, but there are vulnerabilities.

coderextreme avatar Jul 25 '21 01:07 coderextreme

I think I've encountered a similar phenomenon, so I'll write it here.

The node command does not exit when node-java([email protected]) is used

The procedure is as follows

  1. create test.js file
var java = require('java');
var javaLangSystem = java.import('java.lang.System');

javaLangSystem.out.printlnSync('Hello World');
  1. run node test.js

When I use [email protected], I don't get back to the console. However I use [email protected], node exits as expected and returns to the console.

I didn't know where the bug was, I'm sorry

ityuki avatar Jul 27 '21 15:07 ityuki

I just narrowed it down a bit. I could have provided similar code.

See title of mail or issue.

On Tue, Jul 27, 2021 at 10:45 AM ityuki @.***> wrote:

I think I've encountered a similar phenomenon, so I'll write it here.

The node command does not exit when @.***) is used

The procedure is as follows

  1. create test.js file

var java = require('java');var javaLangSystem = java.import('java.lang.System');

javaLangSystem.out.printlnSync('Hello World');

  1. run node test.js

When I use @., I don't get back to the console. However I use @., node exits as expected and returns to the console.

I didn't know where the bug was, I'm sorry

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/joeferner/node-java/issues/527#issuecomment-887623958, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFMJ53YP7HDEE3FHOMTPHLTZ3ICPANCNFSM5A5ABPJA .

coderextreme avatar Jul 27 '21 19:07 coderextreme

Should I create a new issue?

After a little code change, I found the following:

After removing this line, node exits as expected and returns to the console. https://github.com/joeferner/node-java/blob/master/src/java.cpp#L83 However, it's probably not the right change.

In my sense, uvAsync_dynamicProxyJsCall may not have been released. I think I need uv_close somewhere. but I don't understand that is true,sorry...

ityuki avatar Jul 28 '21 02:07 ityuki

I just want to be notified when  a fix is in place.

Perhaps I should upgrade to Node.js 16?

I'm not really sure of compatibility.

John

On 7/27/21 9:07 PM, ityuki wrote:

Should I create a new issue?

After a little code change, I found the following:

After removing this line, node exits as expected and returns to the console. https://github.com/joeferner/node-java/blob/master/src/java.cpp#L83 https://github.com/joeferner/node-java/blob/master/src/java.cpp#L83 However, it's probably not the right change.

In my sense, uvAsync_dynamicProxyJsCall may not have been released. I think I need uv_close somewhere. but I don't understand that is true,sorry...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/joeferner/node-java/issues/527#issuecomment-887953523, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFMJ5673OEALRV4BTQ4UUTTZ5Q53ANCNFSM5A5ABPJA.

coderextreme avatar Jul 28 '21 04:07 coderextreme

@joeferner in my case it hangs on both linux/v12.18.4 and macos/v14.17.3 with latest package from npm. To try to fix it I did

try {
  if(fs.statSync && fs.statSync(path.join(__dirname, "../build/Debug/nodejavabridge_bindings.node")).isFile()) {
    binaryPath = path.resolve(path.join(__dirname, "../build/Debug/nodejavabridge_bindings.node"));
    console.log('****** NODE-JAVA RUNNING IN DEBUG MODE ******');
  }
} catch(e) { // <----- throw an error will avoid node IO loop to hang <----------
  // do nothing fs.statSync just couldn't find the file
  throw new Error('file not found.');
}

but this of course do not solve the problem of this version (file not found...)

loretoparisi avatar Aug 19 '21 11:08 loretoparisi