Search code examples
goartifactory

Artifactory crash due to segmentation violation


We are running Artifactory OSS 7.4.3 in a couple environments, all Linux (RHEL 7). They are using local repositories with standard downloads/uploads of Maven artifacts. Two of those environments have encountered a "segmentation violation" error in the past few weeks. I have not been able to find any documentation of this error occurring during regular operation. My question is how should I go about troubleshooting the error?

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

After this happens, the service is unavailable until someone restarts Artifactory. It shows up in the console.log file, but the surrounding logging does not appear to be related aside from the following stack trace (which looks nearly identical in the two separate instances).

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

Solution

  • This is due to a bug in the Go runtime used at that time (1.14.2), for more details see https://groups.google.com/g/golang-announce/c/XZNfaiwgt2w/m/E6gHDs32AQAJ

    It's been fixed starting from Artifactory 7.7.0, so you can just upgrade to the latest release (7.10.6 when writing this message)