Repository navigation
test: Error: getaddrinfo ENOTFOUND localhost #44003
Copy link
Copy link
Closed
Description
Version
18.6.0
Platform
openSUSE Tumbleweed
Subsystem
No response
What steps will reproduce the bug?
Currently the failures are visible in the current build log,
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior?
No response
What do you see instead?
not ok 1995 parallel/test-net-socket-connect-without-cb
---
duration_ms: 0.506
severity: fail
exitcode: 1
stack: |-
node:events:491
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND localhost
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:111:26)
Emitted 'error' event on Socket instance at:
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'localhost'
}
Node.js v18.6.0
...
...
not ok 2000 parallel/test-net-socket-ready-without-cb
---
duration_ms: 0.507
severity: fail
exitcode: 1
stack: |-
node:events:491
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND localhost
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:111:26)
Emitted 'error' event on Socket instance at:
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'localhost'
}
Node.js v18.6.0
...
not ok 2591 parallel/test-tcp-wrap-listen
---
duration_ms: 0.818
severity: fail
exitcode: 1
stack: |-
(node:18408) internal/test/binding: These APIs are for internal testing only. Do not use them.
(Use `node18 --trace-warnings ...` to show where the warning was created)
node:events:491
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND localhost
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:111:26)
Emitted 'error' event on Socket instance at:
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'localhost'
}
Node.js v18.6.0
...
Additional information
> cat /etc/hosts
127.0.0.1 localhost
#
# hosts This file describes a number of hostname-to-address
# mappings for the TCP/IP subsystem. It is mostly
# used at boot time, when no name servers are running.
# On small systems, this file can be used instead of a
# "named" name server.
# Syntax:
#
# IP-Address Full-Qualified-Hostname Short-Hostname
#
127.0.0.1 localhost
# fallback hostname used by NetworkManager
127.0.0.1 localhost.localdomain
# special IPv6 addresses
::1 localhost ipv6-localhost ipv6-loopback
fe00::0 ipv6-localnet
ff00::0 ipv6-mcastprefix
ff02::1 ipv6-allnodes
ff02::2 ipv6-allrouters
ff02::3 ipv6-allhosts
and resolv.conf doesn't exist. All other test cases that use localhost are passing, as expected.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
kvakil commentedon Jul 27, 2022
curious what you see when doing
strace. On Ubuntu I see the following:theanarkh commentedon Jul 27, 2022
I get this error sometimes on my pc, but not always.
bnoordhuis commentedon Jul 27, 2022
ENOTFOUND is a synthetic error that node fabricates when it doesn't get an answer back from getaddrinfo(3), it's not a real operating system-level error. Reasons include running out of file descriptors in libc (not visible to node), not getting back a response from the DNS server, etc. It's basically a catch-all.
AdamMajer commentedon Jul 27, 2022
In this case, there is no DNS server and it works with other tests...
strace shows nothing. This is only a problem since about 18.2.0 and not before and not in any other released line. And I only see it in a VM build environment and not in a chroot (at least it disappeared there) which is very strange.
I will try to bisect the issue.
bnoordhuis commentedon Jul 28, 2022
You mean v18.1.0 works? There are no changes between the two that seem like likely culprits. I'm interested to see what bisect turns up.
AdamMajer commentedon Jul 28, 2022
So, the bisect ended up on 70b516e which is #43054 . Looking at the pull request, it kind of makes sense this is the one as the tests in question are explicitly skipped on some platforms.
https://github.com/nodejs/node/pull/43054/files#diff-5ba63fa1f910a3ec440b5174993719278ddca69569c0159e2c782173af190602
The test is reproducible every time on openSUSE:Tumbleweed build VM. I can't reproduce it outside of it on a workstation, but in the VM with no networking connections and only a hosts file to resolve localhost to ipv6 and ipv4, it reproduces every time.
I will try to look more closely what is actually failing here.
AdamMajer commentedon Jul 28, 2022
This was introduced in 18.4.0. I mistyped earlier the versions. 18.2.0 still passed
kapouer commentedon Aug 1, 2022
Is there no network interface at all, no loopback ?
AdamMajer commentedon Aug 1, 2022
So, I've learned something about debugging node over last few days :-) But I did find the problem.
The problem is that family is set to a string, which causes hints to be set to 32 which means AI_ADDRCONFIG and then address resolution fails.
On a network connected device, this passes.
Why? We can look at the manpage for
getaddrinfoThis is why these tests fail every time when you have a loopback interface as the only network interface active. They will pass if you have other network interfaces active.
net, dns: socket should handle its output as input
net, dns: socket should handle its output as input
net, dns: socket should handle its output as input
net, dns: socket should handle its output as input
net, dns: socket should handle its output as input
net, dns: socket should handle its output as input
Daniel-quintero1 commentedon Oct 3, 2023
original: Error: getaddrinfo ENOTFOUND undefined
GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:118:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'undefined'
el error aca como podria solucionar? me arroja basicamente que no encuentra mi localhost.
kyungseopk1m commentedon Oct 16, 2023
In my case, the same error occurred when I made a request to a server address other than localhost, but it turned out that there was no problem with me and the problem was with the server.
Additionally, requests intermittently repeated success and failure.
haojieZzz commentedon Aug 2, 2024
I add the line in my hosts file and it worked;
127.0.0.1 localhost