0%

[Go] Broken Pipe Goroutine


有一种人
总是在失去后才问自己为什么当初不能坚持下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2020/06/18 01:29:27 http: panic serving 192.168.32.65:43822: write tcp 10.62.42.224:80->192.168.32.65:43822: write: broken pipe
goroutine 9265526 [running]:
net/http.(*conn).serve.func1(0xc0002330e0)
/usr/local/go/src/net/http/server.go:1772 +0x139
panic(0xcb5c00, 0xc003ba46e0)
/usr/local/go/src/runtime/panic.go:973 +0x396
github.com/gin-gonic/gin/render.JSON.Render(...)
/builds/cidata/prometheus-front-server/vendor/github.com/gin-gonic/gin/render/json.go:58
github.com/gin-gonic/gin.(*Context).Render(0xc0000ca1a0, 0xc8, 0xec8440, 0xc000e02d70)
/builds/cidata/prometheus-front-server/vendor/github.com/gin-gonic/gin/context.go:816 +0x146
github.com/gin-gonic/gin.(*Context).JSON(...)
/builds/cidata/prometheus-front-server/vendor/github.com/gin-gonic/gin/context.go:859
prometheus-front-server/pkg/api/middle.ResponseSuccessQuery(0xc0000ca1a0, 0xec8780, 0xc000122920)
/builds/cidata/prometheus-front-server/pkg/api/middle/response.go:87 +0x148
prometheus-front-server/pkg/api/controller.QueryRangeGet(0xc0000ca1a0)
/builds/cidata/prometheus-front-server/pkg/api/controller/query_get.go:78 +0xa7d
github.com/gin-gonic/gin.(*Context).Next(0xc0000ca1a0)
/builds/cidata/prometheus-front-server/vendor/github.com/gin-gonic/gin/context.go:147 +0x3b
prometheus-front-server/pkg/api/middle.Authorization(0xc0000ca1a0)
/builds/cidata/prometheus-front-server/pkg/api/middle/authorization.go:47 +0x73f
github.com/gin-gonic/gin.(*Context).Next(0xc0000ca1a0)
/builds/cidata/prometheus-front-server/vendor/github.com/gin-gonic/gin/context.go:147 +0x3b
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc00042cb40, 0xc0000ca1a0)
/builds/cidata/prometheus-front-server/vendor/github.com/gin-gonic/gin/gin.go:403 +0x673
github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc00042cb40, 0xecf380, 0xc0008a21c0, 0xc0017c2e00)
/builds/cidata/prometheus-front-server/vendor/github.com/gin-gonic/gin/gin.go:364 +0x14d
net/http.serverHandler.ServeHTTP(0xc0003862a0, 0xecf380, 0xc0008a21c0, 0xc0017c2e00)
/usr/local/go/src/net/http/server.go:2807 +0xa3
net/http.(*conn).serve(0xc0002330e0, 0xed2200, 0xc002753d80)
/usr/local/go/src/net/http/server.go:1895 +0x86c
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2933 +0x35c

这个问题,起初笔者看到吓一大跳。在网上找了好久的答案,基本上可以得到这样的结论:

  • 因为客户端断开了连接导致了在写入的时候有形成了 broken pipe goroutine .
  • 我们需要在客户端直接关闭这个套接字的请求就好了

网上是这么说的,但是还是有很多的不确定的。主要就是这个错误,我看的不是很明白,定位不到这个点。

这是打赏的地方...

本文标题:[Go] Broken Pipe Goroutine

文章作者:Mr.Sun

发布时间:2020年06月18日 - 09:24:48

最后更新:2020年06月18日 - 11:39:29

原始链接:http://www.blog.sun-iot.xyz/posts/8ff97f64

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。

---------Thanks for your attention---------