Docker-node: EAI_AGAIN using alpine

Created on 30 Apr 2019  路  8Comments  路  Source: nodejs/docker-node

I am running an express server on AWS Fargate using the node:10.13.0-alpine image.

A few days ago we had an instance crash, and I found this error in its logs:

Error: getaddrinfo EAI_AGAIN ****.com
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start:js: `cd out; node app.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start:js script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-04-27T11_17_16_680Z-debug.log

Looking online this seems like an alpine issue, but I am not sure, and I am not sure that this is where to fix it, but I was hoping at least for tips on how to fix it for my instance...

Thanks!

alpine

Most helpful comment

alipina will EAI_AGAIN or delays about 5s, using stretch-slim i solved this problem!

All 8 comments

Seems that issue is that the DNS failed to resolve. Is this something that randomly happens or is it reproducible?

It happened randomly, and I haven't been able to reproduce yet...
It might have been a temporary network issue, but I would still like to know if there's a way to prevent this from crashing the whole server and just fail that specific request... but this might not be a question for this repo 馃槙

Is DNS.js your own file or part of express?

I am pretty sure that dns.js is a core nodejs module for handling DNS

Can you try this?

docker run --rm -it node:10.13.0-alpine node -pe 'require("dns").lookup("www.amazon.com",function(){console.dir(arguments)})'

It happens to me also after upgrading from _node:10.15.1-alpine_ to _node:12.1.0-alpine_ .
In my case I set host resolution in docker-compose:

...
extra_hosts:
      - "SQL:192.168.1.xxx"
...

alipina will EAI_AGAIN or delays about 5s, using stretch-slim i solved this problem!

I may be wrong, but it looks like this issue from a different alpine based image: https://github.com/gliderlabs/docker-alpine/issues/255

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marciomsm picture marciomsm  路  4Comments

mtibben picture mtibben  路  3Comments

dionysiusmarquis picture dionysiusmarquis  路  3Comments

NodeGuy picture NodeGuy  路  4Comments

actualben picture actualben  路  3Comments