nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.45k stars 278 forks source link

Assertion failed: unknown EAI_* error code in uv_getaddrinfo_translate_error #4223

Closed nailaiftikhar closed 2 months ago

nailaiftikhar commented 1 year ago

Details

I'm encountering an error with the following assertion message: Assertion failed: (!"unknown EAI_* error code"), function uv_getaddrinfo_translate_error, file src/unix/getaddrinfo.c, line 90.

v18.15.0

Example code

cluster.on('exit', (worker, code, signal) => {
    console.log((JSON.stringify(worker.process.spawnargs))
    console.trace();
    console.log(`worker ${worker.process.pid} died with code ${code} and signal ${signal}`);
    console.log("Let's fork another worker!");
    cluster.fork();
  });
The trace it gives when the error occurs:

Assertion failed: (!"unknown EAI_* error code"), function uv_getaddrinfo_translate_error, file src/unix/getaddrinfo.c, line 90. ["/usr/local/bin/node", "/usr/home/user1/projects/bk-project/dist/shared/app.js"]
Trace
at EventEmitter.<anonymous> (/usr/home/user1/projects/bk-project/dist/shared/app.js:172:41)
at EventEmitter.emit (node: events: 513:28)
at ChildProcess. (node: internal/cluster/primary:188:13)
at Object.onceWrapper (node:events:628:26)
at ChildProcess.emit (node: events: 513:28)
at ChildProcess._handle.onexit (node: internal/child_process: 291:12)
worker 3030 died with code null and signal SIGABRT
Let's fork another worker!

Operating system

Ubuntu Linux

prettydiff commented 1 year ago

What execution steps are you taking to cause this error and what application code causes this error? The Assertion failed leads me to believe this error comes from some use of Node's assert library. The assert library exists to provide comparisons of logic that output to normal human language, such as for test automation. If this occurs in production and is not the result of some form of test automation the use of the assert library is probably not what you want.

I attempted to execute this in the Node shell repl versions 20.2.0 and 18.15.0 and I could not produce an error:

var cluster=require("cluster");cluster.on('exit', function (worker, code, signal) {console.log(JSON.stringify(worker.process.spawnargs));console.log(trace());console.log(`worker ${worker.proces.pid} died with ${code} and signal ${signal}`);cluster.fork();});
nailaiftikhar commented 1 year ago

@prettydiff The issue is not due to this code snippet, this is just a part of node cluster implementation. There are multiple incoming requests on production, and the error's reason is not known yet. That's why I pasted the console trace output here, I want to know if there is any way I can debug this error, i.e., the root cause of it. Or at least make it such that the worker never dies, so that other requests handled by that worker do not get aborted.

prettydiff commented 1 year ago

If the issue is somehow related to clusters I would log the cluster messaging. Clusters coordinate through a messaging scheme.

preveen-stack commented 11 months ago

https://github.com/nodejs/node/issues/49727

github-actions[bot] commented 3 months ago

It seems there has been no activity on this issue for a while, and it is being closed in 30 days. If you believe this issue should remain open, please leave a comment. If you need further assistance or have questions, you can also search for similar issues on Stack Overflow. Make sure to look at the README file for the most updated links.

github-actions[bot] commented 2 months ago

It seems there has been no activity on this issue for a while, and it is being closed. If you believe this issue should remain open, please leave a comment. If you need further assistance or have questions, you can also search for similar issues on Stack Overflow. Make sure to look at the README file for the most updated links.