Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Program Panic #6

Open
ardhitama opened this issue Jan 16, 2019 · 0 comments
Open

Program Panic #6

ardhitama opened this issue Jan 16, 2019 · 0 comments

Comments

@ardhitama
Copy link

ardhitama commented Jan 16, 2019

log:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x41d6c8]
goroutine 24456420 [running]:
[project path]/vendor/github.com/rs/dnscache.(*Resolver).load(0xc00077d7c0, 0xc002218b40, 0x29, 0xc001c11968, 0x451937, 0x0, 0xc001c11980, 0x2, 0x2)
#011/.go/src/[project path]/vendor/github.com/rs/dnscache/dnscache.go:160 +0x78
[project path]/vendor/github.com/rs/dnscache.(*Resolver).lookup(0xc00077d7c0, 0x1232d60, 0xc0000b2010, 0xc002218b40, 0x29, 0xc002218b40, 0x29, 0x28, 0x0, 0xc0035b0000)
#011/.go/src/[project path]/vendor/github.com/rs/dnscache/dnscache.go:77 +0x49
[project path]/vendor/github.com/rs/dnscache.(*Resolver).LookupHost(0xc00077d7c0, 0x1232d60, 0xc0000b2010, 0xc002218b10, 0x28, 0xc001c11ab0, 0x41716f, 0xc001925320, 0x120, 0x110)
#011/.go/src/[project path]/vendor/github.com/rs/dnscache/dnscache.go:44 +0xcd
[project name]/lib/httpx.dnsCachingDialContext.func1(0x1232d60, 0xc0000b2010, 0x1059afd, 0x3, 0xc002218b10, 0x2b, 0x4102a3, 0x682099, 0xc0000b2010, 0xef9640)
#011/.go/src/[project name]/lib/httpx/client.go:44 +0xd2
net/http.(*Transport).dial(0xc000463680, 0x1232d60, 0xc0000b2010, 0x1059afd, 0x3, 0xc002218b10, 0x2b, 0xc002874c00, 0x8, 0x8, ...)
#011/usr/local/go/src/net/http/transport.go:916 +0x20f
net/http.(*Transport).dialConn(0xc000463680, 0x1232d60, 0xc0000b2010, 0x0, 0xc0035b0000, 0x4, 0xc002218b10, 0x2b, 0x0, 0x0, ...)
#011/usr/local/go/src/net/http/transport.go:1240 +0x313
net/http.(*Transport).getConn.func4(0xc000463680, 0x1232d60, 0xc0000b2010, 0xc0036c4060, 0xc000c04a20)
#011/usr/local/go/src/net/http/transport.go:999 +0x6e
created by net/http.(*Transport).getConn
#011/usr/local/go/src/net/http/transport.go:998 +0x3d7
[project name].service: Main process exited, code=exited, status=2/INVALIDARGUMENT
[project name].service: Unit entered failed state.
[project name].service: Failed with result 'exit-code'.```

dnsCachingDialContext func:

func dnsCachingDialContext(r *dnscache.Resolver, timeout time.Duration) func(ctx context.Context, network, addr string) (net.Conn, error) {
	return func(ctx context.Context, network string, addr string) (conn net.Conn, err error) {
		separator := strings.LastIndex(addr, ":")
		ips, err := r.LookupHost(ctx, addr[:separator])
		if err != nil {
			return nil, err
		}
		for _, ip := range ips {
			conn, err = net.DialTimeout(network, ip+addr[separator:], timeout)
			if err == nil {
				break
			}
		}
		return
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant