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

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

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

错误原文

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呢 .... ....


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

查看所有标签

猜你喜欢:

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

Flow-Based Programming (2nd Edition)

Flow-Based Programming (2nd Edition)

CreateSpace / 2010-5-14 / $69.95

Written by a pioneer in the field, this is a thorough guide to the cost- and time-saving advantages of Flow-Based Programming. It explains the theoretical underpinnings and application of this program......一起来看看 《Flow-Based Programming (2nd Edition)》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

在线进制转换器
在线进制转换器

各进制数互转换器

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

URL 编码/解码