Undici throws a ConnectTimeoutError when there is no connection
See original GitHub issueBug Description
If you try to send an HTTP request, but the DNS lookup for the requested domain name fails, Undici may throw a ConnectTimeoutError
.
Reproducible By
I wrote a simple script which reproduces the issue
const { Pool } = require('undici')
const agent = new Pool('http://foobar.bar')
for (let i = 0; i < 500; i++) {
agent.request({ method: 'GET', path: '/foobar' })
.then(async ({ body }) => {
for await (const data of body) {
console.log('data', data.toString('utf8'))
}
})
.catch(console.error)
}
I used undici@5.4.0
Expected Behavior
I’d expect to get only errors which indicate that the DNS lookup has failed.
Logs & Screenshots
Environment
Ubuntu 20.04.4 LTS, Node v16.13.0
Issue Analytics
- State:
- Created a year ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Pip Install Timeout Issue - python - Stack Overflow
when I tried to access the site : https://pypi.org/project/pandas/#files I can access it without any problem on explorer.
Read more >Intermittent ConnectTimeoutError accessing SSM - AWS re:Post
My app uses SSM Parameter Store on Fargate instances and locally in a Docker container. We're accessing it with Boto3 from Python. Multiple...
Read more >Hardhat mumbai forking is throwing ConnectTimeoutError
Apparently, it is thrown at getContractFactory call. ConnectTimeoutError: Connect Timeout Error at Timeout.onConnectTimeout [as _onTimeout] ...
Read more >A Complete Guide to Timeouts in Node.js - Better Stack
It is set to 0 by default which means no timeout, giving the possibility of a connection that hangs forever. To fix this,...
Read more >Connect timeout and execution timeout in nodejs driver
Vlad_Kote (Vlad Kote) March 29, 2020, 11:01pm #1. Hi Guys! I hope I'm posting this in ... It does not have a direct...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
created the following PR: https://github.com/nodejs/undici/pull/1551
reproduce script: