Skip to content

runtime: fatal error: SIGSEGV during C.getaddrinfo #30310

@hawran

Description

@hawran

What version of Go are you using (go version)?

$ go version
go1.11.5 linux/amd64

Does this issue reproduce with the latest release?

This is the latest version, I presume.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/.../.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/.../go/workspace/"
GOPROXY=""
GORACE=""
GOROOT="/home/.../data/opt/go/current"
GOTMPDIR=""
GOTOOLDIR="/home/.../data/opt/go/current/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build917841504=/tmp/go-build -gno-record-gcc-switches"
System (Xubuntu)
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:        18.04
Codename:       bionic
$ uname -a
Linux hawran-lin 4.15.0-45-generic #48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

What did you do?

I've just run sets of my unit tests as usual.

What did you expect to see?

All tests passed.

What did you see instead?

I've come across these fatal errors when I was running some tests which had been OK before. (Meanwhile I'd upgraded my distribution).
Having discussed the issue with my colleagues we've narrowed a list of possible culprits down to a line as follows:
options edns0
It's a line within the /etc/resolv.conf file.
Unfortunately I cannot claim that this option was not in use in the previous version.
However, when I comment that line out, all tests are OK again.

The most irritating symptom of the issue is that the SIGSEGV happens randomly - for instance when a set of tests failed because of one test failed, the same test running alone passes.

I've spent some time to generate a core file, in vain.
So the only thing I can give you at the moment is a couple of lines from a stack trace:

stack trace (shortened)
...
=== RUN   TestLookupLib_LookupA
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x63 pc=0x7f43e539a448]

runtime stack:
runtime.throw(0xb35288, 0x2a)
/home/.../data/opt/go/current/src/runtime/panic.go:608 +0x72
runtime.sigpanic()
/home/.../data/opt/go/current/src/runtime/signal_unix.go:374 +0x2f2

goroutine 28 [syscall]:
runtime.cgocall(0x919b40, 0xc000040e00, 0x29)
/home/.../data/opt/go/current/src/runtime/cgocall.go:128 +0x5e fp=0xc000040dc8 sp=0xc000040d90 pc=0x403bae
net._C2func_getaddrinfo(0xc0001484a0, 0x0, 0xc0001418f0, 0xc0001440e8, 0x0, 0x0, 0x0)
_cgo_gotypes.go:91 +0x55 fp=0xc000040e00 sp=0xc000040dc8 pc=0x589275
net.cgoLookupIPCNAME.func1(0xc0001484a0, 0x0, 0xc0001418f0, 0xc0001440e8, 0xa, 0xa, 0x0)
/home/.../data/opt/go/current/src/net/cgo_unix.go:149 +0x131 fp=0xc000040e48 sp=0xc000040e00 pc=0x58e9a1
net.cgoLookupIPCNAME(0xb22da3, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/.../data/opt/go/current/src/net/cgo_unix.go:149 +0x153 fp=0xc000040f38 sp=0xc000040e48 pc=0x58a833
net.cgoIPLookup(0xc000150840, 0xb22da3, 0x9)
/home/.../data/opt/go/current/src/net/cgo_unix.go:201 +0x4d fp=0xc000040fc8 sp=0xc000040f38 pc=0x58aeed
runtime.goexit()
/home/.../data/opt/go/current/src/runtime/asm_amd64.s:1333 +0x1 fp=0xc000040fd0 sp=0xc000040fc8 pc=0x45cfd1
created by net.cgoLookupIP
/home/.../data/opt/go/current/src/net/cgo_unix.go:211 +0xad

goroutine 1 [chan receive]:
testing.(*T).Run(0xc0001ea400, 0xb2785a, 0x15, 0xb44b50, 0x47d301)
/home/.../data/opt/go/current/src/testing/testing.go:879 +0x383
testing.runTests.func1(0xc0001ea000)
/home/.../data/opt/go/current/src/testing/testing.go:1119 +0x78
testing.tRunner(0xc0001ea000, 0xc00009bda0)
/home/.../data/opt/go/current/src/testing/testing.go:827 +0xbf
testing.runTests(0xc00000cb00, 0x1212000, 0xe, 0xe, 0x40caff)
/home/.../data/opt/go/current/src/testing/testing.go:1117 +0x2aa
testing.(*M).Run(0xc00010e300, 0x0)
/home/.../data/opt/go/current/src/testing/testing.go:1034 +0x165
main.main()
_testmain.go:126 +0x205

goroutine 22 [syscall]:
os/signal.signal_recv(0xb46240)
/home/.../data/opt/go/current/src/runtime/sigqueue.go:139 +0x9c
os/signal.loop()
/home/.../data/opt/go/current/src/os/signal/signal_unix.go:23 +0x22
created by os/signal.init.0
/home/.../data/opt/go/current/src/os/signal/signal_unix.go:29 +0x41

goroutine 9 [select]:
net.(*Resolver).LookupIPAddr(0x125cc60, 0xbbc520, 0xc000150720, 0xb22da3, 0x9, 0xb22dad, 0x4, 0x14ea, 0x0, 0x0)
/home/.../data/opt/go/current/src/net/lookup.go:227 +0x55f
net.(*Resolver).internetAddrList(0x125cc60, 0xbbc520, 0xc000150720, 0xb1b388, 0x3, 0xb22da3, 0xe, 0x0, 0x0, 0x0, ...)
/home/.../data/opt/go/current/src/net/ipsock.go:279 +0x614
net.(*Resolver).resolveAddrList(0x125cc60, 0xbbc520, 0xc000150720, 0xb1b902, 0x4, 0xb1b388, 0x3, 0xb22da3, 0xe, 0x0, ...)
/home/.../data/opt/go/current/src/net/dial.go:202 +0x4fb
net.(*Dialer).DialContext(0xc000097b90, 0xbbc4e0, 0xc000024148, 0xb1b388, 0x3, 0xb22da3, 0xe, 0x0, 0x0, 0x0, ...)
/home/.../data/opt/go/current/src/net/dial.go:384 +0x201
net.(*Dialer).Dial(0xc000052b90, 0xb1b388, 0x3, 0xb22da3, 0xe, 0x203000, 0x8, 0x7f43ea8cd148, 0x8)
/home/.../data/opt/go/current/src/net/dial.go:329 +0x75
.../goutils/vendor/github.com/miekg/dns.(*Client).Dial(0xc0001b5420, 0xb22da3, 0xe, 0xaa7aa0, 0xc00019b500, 0x2183ddc47ec6)
/home/.../go/workspace/src/.../goutils/vendor/github.com/miekg/dns/client.go:104 +0x2c0
.../goutils/vendor/github.com/miekg/dns.(*Client).exchange(0xc0001b5420, 0xc00020c000, 0xb22da3, 0xe, 0x0, 0x0, 0x0, 0x0)
/home/.../go/workspace/src/.../goutils/vendor/github.com/miekg/dns/client.go:152 +0x69
.../goutils/vendor/github.com/miekg/dns.(*Client).Exchange(0xc0001b5420, 0xc00020c000, 0xb22da3, 0xe, 0xc00020c000, 0x101, 0x110, 0xc0000bd560)
/home/.../go/workspace/src/.../goutils/vendor/github.com/miekg/dns/client.go:129 +0x2b7
.../goutils/resolver.(*LookupLib).lookup(0xc000046778, 0xb22c7d, 0xe, 0xb1acfa, 0x1, 0x0, 0x0, 0xb46360, 0x1261660, 0x1312)
/home/.../go/workspace/src/.../goutils/resolver/lookup.go:202 +0x279
.../goutils/resolver.(*LookupLib).lookupType(0xc000046778, 0xb22c7d, 0xe, 0xb1acfa, 0x1, 0xc000001b00, 0x1261660, 0x1261660)
/home/.../go/workspace/src/.../goutils/resolver/lookup.go:166 +0x6c
.../goutils/resolver.(*LookupLib).LookupA(0xc000097f78, 0xb22c7d, 0xe, 0xc0001ea500, 0xc00006cdc0, 0xf, 0xff43cd, 0x37, 0x44c9a8)
/home/.../go/workspace/src/.../goutils/resolver/lookup.go:78 +0x62
.../goutils/resolver.TestLookupLib_LookupA(0xc0001ea400)
/home/.../go/workspace/src/.../goutils/resolver/lookup_test.go:64 +0x188
testing.tRunner(0xc0001ea400, 0xb44b50)
/home/.../data/opt/go/current/src/testing/testing.go:827 +0xbf
created by testing.(*T).Run
/home/.../data/opt/go/current/src/testing/testing.go:878 +0x35c

goroutine 10 [IO wait]:
internal/poll.runtime_pollWait(0x7f43e6652f00, 0x72, 0x0)
/home/.../data/opt/go/current/src/runtime/netpoll.go:173 +0x66
internal/poll.(*pollDesc).wait(0xc00010e418, 0x72, 0xc00006cf00, 0x0, 0x0)
/home/.../data/opt/go/current/src/internal/poll/fd_poll_runtime.go:85 +0x9a
internal/poll.(*pollDesc).waitRead(0xc00010e418, 0xffffffffffffff00, 0x0, 0x0)
/home/.../data/opt/go/current/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Accept(0xc00010e400, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/.../data/opt/go/current/src/internal/poll/fd_unix.go:384 +0x1a0
net.(*netFD).accept(0xc00010e400, 0x0, 0xc000032000, 0x0)
/home/.../data/opt/go/current/src/net/fd_unix.go:238 +0x42
net.(*TCPListener).accept(0xc00000e108, 0xc000057e48, 0x6bade7, 0xc0001ea5bc)
/home/.../data/opt/go/current/src/net/tcpsock_posix.go:139 +0x2e
net.(*TCPListener).Accept(0xc00000e108, 0xb45201, 0xc000024cd0, 0xc0001ea500, 0x1)
/home/.../data/opt/go/current/src/net/tcpsock.go:260 +0x47
.../goutils/vendor/github.com/miekg/dns.(*Server).serveTCP(0xc0001ea500, 0xbbbaa0, 0xc00000e108, 0x0, 0x0)
/home/.../go/workspace/src/.../goutils/vendor/github.com/miekg/dns/server.go:487 +0xfd
.../goutils/vendor/github.com/miekg/dns.(*Server).ListenAndServe(0xc0001ea500, 0x0, 0x0)
/home/.../go/workspace/src/.../goutils/vendor/github.com/miekg/dns/server.go:342 +0x2a2
.../goutils/testutils.Serve(0xc0001ea400, 0xc0001ea500)
/home/.../go/workspace/src/.../goutils/testutils/simpledns.go:93 +0x2b
created by .../goutils/resolver.TestLookupLib_LookupA
/home/.../go/workspace/src/.../goutils/resolver/lookup_test.go:58 +0xd7

goroutine 27 [select]:
net.cgoLookupIP(0xbbc4a0, 0xc00014c6c0, 0xb22da3, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/.../data/opt/go/current/src/net/cgo_unix.go:212 +0x17b
net.(*Resolver).lookupIP(0x125cc60, 0xbbc4a0, 0xc00014c6c0, 0xb22da3, 0x9, 0x0, 0xc00012a600, 0xc00014c680, 0x0, 0x0)
/home/.../data/opt/go/current/src/net/lookup_unix.go:95 +0x166
net.(*Resolver).lookupIP-fm(0xbbc4a0, 0xc00014c6c0, 0xb22da3, 0x9, 0x42c072, 0x8, 0xc00014c680, 0x0, 0xc000040ea0)
/home/.../data/opt/go/current/src/net/lookup.go:207 +0x56
net.glob..func1(0xbbc4a0, 0xc00014c6c0, 0xc00013ee50, 0xb22da3, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/.../data/opt/go/current/src/net/hook.go:19 +0x52
net.(*Resolver).LookupIPAddr.func1(0x0, 0x0, 0x0, 0x0)
/home/.../data/opt/go/current/src/net/lookup.go:221 +0xd8
internal/singleflight.(*Group).doCall(0x125cc70, 0xc0001528c0, 0xb22da3, 0x9, 0xc000141860)
/home/.../data/opt/go/current/src/internal/singleflight/singleflight.go:95 +0x2e
created by internal/singleflight.(*Group).DoChan
/home/.../data/opt/go/current/src/internal/singleflight/singleflight.go:88 +0x2a0
FAIL .../goutils/resolver 1.013s

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions