http请求中什么ENOTFOUND错误(不时发生)意味着什么? [英] What ENOTFOUND error in an http request, happening time to time, means?

查看:4266
本文介绍了http请求中什么ENOTFOUND错误(不时发生)意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个nodejs服务器,在托管的云计算机上运行. http请求

I have a nodejs server, running on an hosted cloud machine. An http request

var req = Http.request(options, function(res) { ... }

带有选项

host: "www.mysite.com"    
port: "8080"
method: "GET"
path: "/someurl"

有时会回答此错误(假设十分之一)

reply with this error sometimes (let's say one time out of ten)

{"code":"ENOTFOUND","errno":"ENOTFOUND","syscall":"getaddrinfo"}

现在,问题是这个错误可能意味着什么.

Now, the question is what this error could mean.

该请求似乎是正确的(正确的路径,正确的端口,有效的URL和摇摆的路径,路径中未包含http协议,该路径是在同一台计算机上运行的站点的drupal页面),并且几乎所有时间.有时,没有明显的原因,它会失败.

The request seems to be correct (right path, right port, url alive and rocking, no http protocol included in path, the path is to a drupal page of a site running on the same machine) and it works almost all the time. Sometimes, with no apparent reason, it fails.

最近,我在机器上注意到有关ipv6的问题,我不得不在sysctl上将其禁用以使事情正常进行.在出现有关ipv6的问题后,以可疑的精度提出了问题.也许此错误是由计算机本身上的某些dns问题引起的(所以我必须怪我的主机)?

Recently, I noticed, on the machine, issues about ipv6 and I had to disable it on sysctl to make things work. The problem raised with suspicious precision after the issue about ipv6 showed up. Maybe this error is caused by some dns issues on the machine itself (so i have to blame my host)?

推荐答案

这是DNS错误,具体地说,Node无法将主机名"www.mysite.com" 解析为IP地址.

It's DNS errors, specifically, Node can't resolve a hostname "www.mysite.com" to an IP-address.

可能有多种原因:

  • 主机名无效
  • 您的网络连接有问题
  • 您的DNS服务器出现故障
  • 处理"mysite.com" 的DNS服务器出现故障
  • the hostname is just invalid
  • your network connection is faulty
  • your DNS server is faulty
  • the DNS server that handles "mysite.com" is faulty

一个提示:当您的问题有效时,调试根本原因(DNS问题)在StackOverflow上就不那么重要了.

As a heads-up: while your question is valid, debugging the underlying cause (DNS issues) is off-topic on StackOverflow.

这篇关于http请求中什么ENOTFOUND错误(不时发生)意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆