Closed felixdivo closed 3 years ago
This script can reproduce the error:
const rclnodejs = require('rclnodejs');
rclnodejs.regenerateAll().then(() => {
rclnodejs.init().then(() => {
const node = rclnodejs.createNode('some_node_name_wow');
rclnodejs.spin(node);
})
})
The reason why you got the error is that you terminated the process before the Promise
return by rclnodejs.regenerateAll()
is resolved, so the rclnodejs module hasn't been started practically. Normally, generating all the messages triggered by regenerateAll()
method takes more around 20s, so you could wait for a while and then press ctrl+c
to check if the error is still reported.
It would be much like the existing Context.tryShutdown(): Don't do anything if the (default) context is already shut down and else shut it down now. Is such a change welcome? If yes, I can offer to implement it.
+1, I think it's more user friendly, please go-ahead to submit the PR, thanks!
Okay, I'll give it a shot.
so you could wait for a while and then press
ctrl+c
to check if the error is still reported
Seems like it's something else: I waited for an hour (while having lunch) and it still happened.
Oops, I am going to check it locally.
const rclnodejs = require('rclnodejs');
rclnodejs.regenerateAll().then(() => {
rclnodejs.init().then(() => {
// Please print a log here to ensure the promise has been resolved.
// I cannot reproduce it on my local linux with develop branch.
const node = rclnodejs.createNode('some_node_name_wow');
rclnodejs.spin(node);
})
})
Every time I close my node.js server with rclnodejs running I get this error message:
It originates from here: https://github.com/RobotWebTools/rclnodejs/blob/178c2c7068e9c1961f0db3328ab74a366803340e/index.js#L410-L414
I don't quite get why it is raised in the first place, but anyhow, wouldn't it be better if there was a
rclnodejs.tryShutdown()
method that would be called in that event instead? It would be much like the existingContext.tryShutdown()
: Don't do anything if the (default) context is already shut down and else shut it down now.Is such a change welcome? If yes, I can offer to implement it.