Go语言 分段冲突导致伪影崩溃

k5hmc34c  于 2023-04-09  发布在  Go
关注(0)|答案(1)|浏览(132)

我们在几个环境中运行Artifactory OSS 7.4.3,所有Linux(RHEL 7)。他们使用本地存储库进行Maven工件的标准下载/上传。在过去的几周里,其中两个环境遇到了“分段违规”错误。我无法找到任何在常规操作期间发生此错误的文档。我的问题是我应该如何解决这个错误?

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x576a4f]

发生这种情况后,服务不可用,直到有人重新启动Artifactory。它显示在console.log文件中,但周围的日志记录似乎没有相关,除了下面的堆栈跟踪(在两个单独的示例中几乎相同)。

goroutine 20767483 [running]:
bufio.(*Writer).Available(...)
/go/src/bufio/bufio.go:610
bufio.(*Writer).WriteString(0x0, 0x2e1d3b6, 0x19, 0x40e076, 0x7f89b90d56d0, 0x67)
/go/src/bufio/bufio.go:691 +0x7f
net/http.(*expectContinueReader).Read(0xc00081c9e0, 0xc001170000, 0x210c, 0x210c, 0x7f89b90d56d0, 0x0, 0x10)
/go/src/net/http/server.go:888 +0x13b
github.com/containous/traefik/middlewares/accesslog.(*captureRequestReader).Read(0xc00081cc00, 0xc001170000, 0x210c, 0x210c, 0x26537a0, 0xc00020ad01, 0xc001170000)
/go/pkg/mod/github.com/omerkay/traefik@v1.7.22-h2c/middlewares/accesslog/capture_request_reader.go:11 +0x51
io.(*LimitedReader).Read(0xc001096240, 0xc001170000, 0x210c, 0x210c, 0x0, 0xc000bf4800, 0x40bf28)
/go/src/io/io.go:448 +0x63
io.copyBuffer(0x33338e0, 0xc001069050, 0x332fba0, 0xc001096240, 0xc001170000, 0x210c, 0x210c, 0x5, 0xc000bf49b0, 0x5)
/go/src/io/io.go:402 +0x122
io.Copy(...)
/go/src/io/io.go:364
net.genericReadFrom(0x3330720, 0xc000f9a660, 0x332fba0, 0xc001096240, 0x0, 0x0, 0x2cd0600)
/go/src/net/net.go:625 +0x9a
net.(*TCPConn).readFrom(0xc000f9a660, 0x332fba0, 0xc001096240, 0xc000bf49e8, 0x40c1fa, 0x28acde0)
/go/src/net/tcpsock_posix.go:54 +0xe2
net.(*TCPConn).ReadFrom(0xc000f9a660, 0x332fba0, 0xc001096240, 0x7f89b4e977e8, 0xc000f9a660, 0x1)
/go/src/net/tcpsock.go:103 +0x4d
io.copyBuffer(0x3330720, 0xc000f9a660, 0x332fba0, 0xc001096240, 0x0, 0x0, 0x0, 0x29fdba0, 0x7f89b4d0f001, 0x7f89b4e977c8)
/go/src/io/io.go:388 +0x2ed
io.Copy(...)
/go/src/io/io.go:364
net/http.persistConnWriter.ReadFrom(0xc000bed680, 0x332fba0, 0xc001096240, 0x7f89b4e977c8, 0xc000bed680, 0x1)
/go/src/net/http/transport.go:1600 +0x85
bufio.(*Writer).ReadFrom(0xc000aef980, 0x332fba0, 0xc001096240, 0x7f89b4cffcc8, 0xc000aef980, 0x1)
/go/src/bufio/bufio.go:713 +0x34a
io.copyBuffer(0x332bd20, 0xc000aef980, 0x332fba0, 0xc001096240, 0x0, 0x0, 0x0, 0xc000bf4c38, 0x40e8e8, 0x20)
/go/src/io/io.go:388 +0x2ed
io.Copy(...)
/go/src/io/io.go:364
net/http.(*transferWriter).doBodyCopy(0xc0008f4640, 0x332bd20, 0xc000aef980, 0x332fba0, 0xc001096240, 0x0, 0xc000bf4ee0, 0xc000e484b0)
/go/src/net/http/transfer.go:400 +0x6a
net/http.(*transferWriter).writeBody(0xc0008f4640, 0x332bd20, 0xc000aef980, 0x2, 0x2)
/go/src/net/http/transfer.go:359 +0x6da
net/http.(*Request).write(0xc000e9fa00, 0x332bd20, 0xc000aef980, 0x0, 0x0, 0xc00081ce20, 0x0, 0x0)
/go/src/net/http/request.go:682 +0x6d3
net/http.(*persistConn).writeLoop(0xc000bed680)
/go/src/net/http/transport.go:2208 +0x1c8
created by net/http.(*Transport).dialConn
/go/src/net/http/transport.go:1576 +0xb32
mwkjh3gx

mwkjh3gx1#

这是由于当时使用的Go运行时(1.14.2)中的一个bug,有关更多详细信息,请参阅https://groups.google.com/g/golang-announce/c/XZNfaiwgt2w/m/E6gHDs32AQAJ
从Artifactory 7.7.0开始,它已经被修复,因此您可以升级到最新版本(在撰写此消息时为7.10.6)

相关问题