Skip to content
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

Assertion failed: (!"unknown EAI_* error code"), function uv__getaddrinfo_translate_error, file src/unix/getaddrinfo.c, line 90. #51262

Open
BenoitMercier opened this issue Dec 22, 2023 · 4 comments
Labels
libuv Issues and PRs related to the libuv dependency or the uv binding.

Comments

@BenoitMercier
Copy link

BenoitMercier commented Dec 22, 2023

Version

16.18.1

Platform

FreeBSD eisy 13.2-RELEASE-p4 FreeBSD 13.2-RELEASE-p4 #9 releng/13.2-n254638-d20ece445acf-dirty: Fri Oct 20 16:50:52 UTC 2023 [email protected]:/usr/obj/usr/src/amd64.amd64/sys/eisy amd64

Subsystem

https://github.com/nodejs/node/blob/main/deps/uv/src/unix/getaddrinfo.c

What steps will reproduce the bug?

node.js crashes randomly with this error. We can not find any way to reproduce it.

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior? Why is that the expected behavior?

No response

What do you see instead?

node.js crashes randomly with this error:
Assertion failed: (!"unknown EAI_* error code"), function uv__getaddrinfo_translate_error, file src/unix/getaddrinfo.c, line 90.

Additional information

I believe the error would be caused by a EAI_MAX error

FreeBSD glibc's getaddrinfo() can return a EAI_MAX error, which is not trapped by libuv uv__getaddrinfo_translate_error()

Ref:
getaddrinfo man page says it can return errors from gai_strerror(3)
Freebsd man page: https://man.freebsd.org/cgi/man.cgi?query=getaddrinfo&sektion=3
gai_strerror(3): https://man.freebsd.org/cgi/man.cgi?query=gai_strerror&sektion=3&manpath=FreeBSD+13.2-
RELEASE+and+Ports

When googling around, I can find a reference to EAI_MAX error in netdb.h.
Ref: https://gitea-dev.freebsd.org/FreeBSD/src/src/tag/release/13.1.0/include/netdb.h

In node.js' uv__getaddrinfo_translate_error(), there is a case for all errors, except EAI_MAX
That's the case for node.js 16.18.1 which we are using, but also the main branch too.

Ref: https://github.com/nodejs/node/blob/main/deps/uv/src/unix/getaddrinfo.c

Therefore, we probably need to add:
#if defined(EAI_MAX)
case EAI_MAX: return UV_EAI_MAX;
#endif

And of course UV_EAI_MAX would need to be defined.

@marco-ippolito marco-ippolito added the libuv Issues and PRs related to the libuv dependency or the uv binding. label Dec 23, 2023
@marco-ippolito
Copy link
Member

cc @nodejs/libuv

@santigimeno
Copy link
Member

@BenoitMercier thanks for the report. Can you confirm that the error is actually EAI_MAX or is it just a guess? If the latter, can you add a printf in uv__getaddrinfo_translate_error() so we can actually know the error?

@saghul
Copy link
Member

saghul commented Dec 25, 2023

Looks like we should have that mapping in libuv indeed.

@BenoitMercier
Copy link
Author

BenoitMercier commented Dec 28, 2023

@santigimeno

@BenoitMercier thanks for the report. Can you confirm that the error is actually EAI_MAX or is it just a guess? If the latter, can you add a printf in uv__getaddrinfo_translate_error() so we can actually know the error?

I have no clue how to compile. I just identified EAI_MAX as the only possibility looking at uv__getaddrinfo_translate_error() and netdb.h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libuv Issues and PRs related to the libuv dependency or the uv binding.
Projects
None yet
Development

No branches or pull requests

5 participants
@saghul @santigimeno @BenoitMercier @marco-ippolito and others