foxcpp / go-mockdns

Boilerplate for testing of code involving DNS lookups, including unholy hacks to redirect net.Lookup* calls.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

panic in PatchNet closure

acud opened this issue Β· comments

commented

Heya! πŸ‘‹

We've been having some panics on our CI from the library recently.

Env: Macos github action build, golang go test suite with race detector on:

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

goroutine 10490 [running]:
github.com/foxcpp/go-mockdns.(*Server).PatchNet.func1(0x57deda0, 0xc00010aa20, 0x54de8f6, 0x3, 0xc00010daa0, 0xa, 0x0, 0x0, 0x0, 0x403a0bd)
	/Users/runner/go/pkg/mod/github.com/foxcpp/go-mockdns@v0.0.0-20201212160233-ede2f9158d15/server.go:381 +0x59
net.(*Resolver).dial(0x6016800, 0x57deda0, 0xc00010aa20, 0x54de8f6, 0x3, 0xc00010daa0, 0xa, 0xc000507660, 0x0, 0x0, ...)
	/Users/runner/hostedtoolcache/go/1.15.8/x64/src/net/lookup_unix.go:67 +0x334
net.(*Resolver).exchange(0x6016800, 0x57ded20, 0xc000b47400, 0xc00010daa0, 0xa, 0x6d6f632e34767069, 0x2e, 0x0, 0x0, 0x0, ...)
	/Users/runner/hostedtoolcache/go/1.15.8/x64/src/net/dnsclient_unix.go:156 +0x2e7
net.(*Resolver).tryOneName(0x6016800, 0x57ded20, 0xc000b47400, 0xc0004c4460, 0xc00010dae0, 0x9, 0xc00000001c, 0x0, 0x0, 0x0, ...)
	/Users/runner/hostedtoolcache/go/1.15.8/x64/src/net/dnsclient_unix.go:256 +0x42f
net.(*Resolver).goLookupIPCNAMEOrder.func3.1(0x6016800, 0x57ded20, 0xc000b47400, 0xc0004c4460, 0xc00010dae0, 0x9, 0xc00010a5a0, 0x1c)
	/Users/runner/hostedtoolcache/go/1.15.8/x64/src/net/dnsclient_unix.go:602 +0xd2
created by net.(*Resolver).goLookupIPCNAMEOrder.func3
	/Users/runner/hostedtoolcache/go/1.15.8/x64/src/net/dnsclient_unix.go:601 +0x105