-
Notifications
You must be signed in to change notification settings - Fork 562
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
EAI_AGAIN Error Not Thrown on getaddrinfo Failure #3951
Comments
Hi, We are also facing this problem and it's quite annoying as it is now harder to find out that one of services it is down it is not ready yet. Is a fix coming soon? If not, is there any workaround? Thanks in advance! |
Thanks for reporting! Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that. |
Hi, Here you have an example, you only need to do a simple request with the errors interceptor:
In my case I found the problem using docker, but it happens even without docker with a simple request. You can execute the example in this stackblitz: https://stackblitz.com/edit/node-fmjmkavv?file=index.js In my use case, one microservice must request another one in the same docker network, but the one receiving the request is still not up. Prior to version 7 we were receiving EAI_AGAIN if the microservice was not up with throwError, but now, with Undici 7, we just receive and empty response without any error even if there is nobody to reply. |
I found another issue related to interceptors while investigating the missing EAI_AGAIN error. Using the dns interceptor in combination with the responseError interceptor causes inconsistent behavior depending on their order:
Here’s a reproducible example: const { request, interceptors, getGlobalDispatcher } = require('undici');
(async () => {
try {
const response = await request('http://users:1000/',
{
dispatcher: getGlobalDispatcher().compose([interceptors.dns(), interceptors.responseError()])
});
console.log(response);
} catch (error) {
console.error('Caught error:', error);
}
})(); |
The order of the interceptors matter, that's why you get one or the other depending on that. For the combination of interceptors problems, I found the problem and the fix is on its way. |
Hi, I don't know if by first error you are referring to the one I mentioned. Here you have a screenshot from the stackblitz showing the problem: As you can see in the image, executing the code with the response error interceptor is not throwing any error However, it works without the interceptor: So the problem seems to be related with the response error interceptor that is not throwing the error in some cases. Here the link to the stackblitz just in case it might help: https://stackblitz.com/edit/node-fmjmkavv?file=index.js |
Yeah. was referring to this one. When attempting I was able to fully see the error being thrown (I tried with latest in |
Bug Description
In undici versions @7.1.0, and @7.0.0 the EAI_AGAIN error is no longer thrown when the getaddrinfo syscall fails. Instead, the request returns an object with { opaque: null }, which is unexpected behavior.
Additionally, this issue might be related to fix: response error interceptor #3930.
Reproducible By
The text was updated successfully, but these errors were encountered: