Closed arch3754 closed 1 year ago
@arch3754 你的go 版本是多少?
当err是(*net.OpError)时,把这个err的各字段信息打印出来,看看哪里有问题,或许踩到了一个go的bug.
type OpError struct {
Op string
Net string
Source Addr
Addr Addr
Err error
}
尤其是Err字段,可以同时%T
打印出这个字段的实际类型
如果你不能复现,我建议你加一层保护,如果是(net.OpError), 直接返回`net.OpError, 而不是
fmt.Sprintf("%v", err)`。
当然,如果你能复现是最好了。 复现的时候先把这个net.OpError各字段信息打印出来,看看有没有啥异常。
go 版本1.18.5和1.19.2都有问题,我先打出来试试,不太容易复现,好多天才能复现一次
如图:
部署环境是在公网,请求的目标地址也是公网 以下是对应代码块,在fmt.Sprintf("%v", err)时panic