-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Worker does not exit on EHOSTUNREACH
error?
#62
Labels
Comments
After restarting the backend, tasks down to 34 and the journal is flooded with disconnects:
|
A quick fix would be a const net = require("net");
module.exports = ({ host, port }) => {
const logger = require("../system/logger.js");
let socket = new net.Socket();
// keep socket alive
socket.setKeepAlive(true, 5000);
//socket.unref(); // test for #62, did nothing!
socket.on("error", (err) => {
logger.error(`[error] tcp://${host}:${port}`, err);
// why not cal process.exit() here?
// this file/function should only be called in a worker thread
// so it dosnt matter if the process exits or not...
// if the socket.unref() approach fails, try the exit method
process.exit(1);
});
socket.on("close", () => {
logger.debug(`[closed] tcp://${host}:${port}`);
});
socket.on("connect", () => {
logger.info(`[connected] tcp://${host}:${port}`);
});
socket.connect(port, host);
return socket;
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Trying to connect to a invalid/non exisiting/offline tcp socket/server, causes to spwan worker, but do not exit.
This creates a memory leak.
Related/debugging information: #61
A watch on
watch -n 10 "systemctl status connector"
and trying to connect to a offline raspberry increases the Tasks number continusly.start to watch:
16:23 = 49
16:25 = 51
16:28 = 54
16:33 = 63
16:37 = 69
The text was updated successfully, but these errors were encountered: