golang启动时etcd报错 panic: context deadline exceeded

栏目: Go · 发布时间: 5年前

内容简介:错误原文初步判断检测

错误原文

panic: context deadline exceeded

goroutine 1 [running]:
git.dz11.com/wsd/live/app/listapp-go/vendor/git.dz11.com/vega/etcher.init.0()
        /home/work/workspace/Go/src/git.dz11.com/wsd/live/app/listapp-go/vendor/git.dz11.com/vega/etcher/init.go:21 +0x130
exit status 2

初步判断

  • 由错误提示可知是etcher --- golang的一个etcd客户端 连接超时.

检测

  • 直接本地 shell 连接etcd
etcdctl endpoint health --endpoints=[etcd-naming1.dz11.com:2379] 

# 结果显示etcd连接正常
etcd-naming1.dz11.com:2379 is healthy: successfully committed proposal: took = 46.792953ms
  • 直接ping etcd的域名 正常.
  • 将golang项目中配置的域名变更为ip 项目启动成功

二次判断

  • 怀疑dns有问题. 但是本地的各种命令都显示dns没有问题.

二次检测

  • 检测自己所有的nameservers 发现果然又一个 nameserver 是坏的 ... 注释掉坏的dns nameserver . 项目启动成功.

结论

  • golang和shell对dns的 nameserver访问不一样. golang底层库中 为了并发的获取 ipv4 以及 ipv6 会同时用到两个nameserver 如果有一个是坏的... 就会超时... 细节参考上面贴出来的地址...

真实蛋疼的bug呢 .... ....


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

PHP for the World Wide Web, Second Edition (Visual QuickStart Gu

PHP for the World Wide Web, Second Edition (Visual QuickStart Gu

Larry Ullman / Peachpit Press / 2004-02-02 / USD 29.99

So you know HTML, even JavaScript, but the idea of learning an actual programming language like PHP terrifies you? Well, stop quaking and get going with this easy task-based guide! Aimed at beginning ......一起来看看 《PHP for the World Wide Web, Second Edition (Visual QuickStart Gu》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

html转js在线工具
html转js在线工具

html转js在线工具