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

遇到 getaddrinfo ENOTFOUND 问题 #152

Closed
popomore opened this issue Oct 24, 2016 · 10 comments · Fixed by #153
Closed

遇到 getaddrinfo ENOTFOUND 问题 #152

popomore opened this issue Oct 24, 2016 · 10 comments · Fixed by #153

Comments

@popomore
Copy link
Contributor

不确定是否是问题,在 travis 和 appvoyer 都遇到这个问题,按道理 dns 不应该会有问题,难道是 node6 的 bug?

https://ci.appveyor.com/project/eggjs/egg-core/build/1.0.141

@popomore
Copy link
Contributor Author

@fengmk2
Copy link
Member

fengmk2 commented Oct 24, 2016

DNS 请求太快了,估计是npm registry没有返回keeplaive导致的

@popomore
Copy link
Contributor Author

加一层 dns 缓存?

@fengmk2
Copy link
Member

fengmk2 commented Oct 24, 2016

嗯,加一下好了。

@popomore
Copy link
Contributor Author

这个准备做在哪?

先查一下 dns,如果获取了 ip 就使用 ip 请求,否则走原来逻辑。

@fengmk2
Copy link
Member

fengmk2 commented Oct 24, 2016

先 dns.lookup 找到 ip,再请求。

@fengmk2
Copy link
Member

fengmk2 commented Oct 24, 2016

https://github.com/node-modules/urllib/blob/master/lib/urllib.js#L111 custom dns lookup 只支持 http,https 还不知道如何覆盖。。。

@popomore
Copy link
Contributor Author

单独 lookup,然后传 ip 和 host 进去?

@fengmk2
Copy link
Member

fengmk2 commented Oct 24, 2016

不行的,https 比较特殊。我先对 agent 的 maxSockets 设置一个上限20,这样就不会大量 dns lookup 了 https://nodejs.org/api/http.html#http_agent_maxsockets

@popomore
Copy link
Contributor Author

恩,现在这个错比较常见

fengmk2 added a commit that referenced this issue Oct 24, 2016
fengmk2 added a commit that referenced this issue Oct 24, 2016
closes #152

* deps: use agentkeepalive
* fix: use registry.npmjs.org instead of registry.npmjs.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants