Open johnbelamaric opened 1 year ago
Which version of kpt are you using? With the kpt built from HEAD of the repo, I'm unable to reproduce this issue. I'm getting:
$ kpt alpha rpkg get
Error: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused
I'm seeing a similar crash, but I'm not able to get around it using --kubeconfig
as suggested. I'm guessing this regression was introduced sometime after 1.0.0-beta.20
. Reverting back to this version does not give me SIGSEGV.
1.0.0-beta.21
& 1.0.0-beta.23
both do.
If it helps, my env looks something like:
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.12", GitCommit:"c6939792865ef0f70f92006081690d77411c8ed5", GitTreeState:"clean", BuildDate:"2022-09-21T12:20:29Z", GoVersion:"go1.17.13", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"23+", GitVersion:"v1.23.13-eks-fb459a0", GitCommit:"55bd5d5cb7d32bc35e4e050f536181196fb8c6f7", GitTreeState:"clean", BuildDate:"2022-10-24T20:35:40Z", GoVersion:"go1.17.13", Compiler:"gc", Platform:"linux/amd64"}
$ aws --version
aws-cli/2.8.12 Python/3.9.11 Linux/6.0.6-arch1-1 exe/x86_64.arch prompt/off
$ kubectl --kubeconfig kubeconfig config view
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: DATA+OMITTED
server: https://xx.xx.us-east-1.eks.amazonaws.com
name: arn:aws:eks:us-east-1:xx:cluster/prod-01
contexts:
- context:
cluster: arn:aws:eks:us-east-1:xx:cluster/prod-01
user: arn:aws:eks:us-east-1:xx:cluster/prod-01
name: ptr
current-context: ptr
kind: Config
preferences: {}
users:
- name: arn:aws:eks:us-east-1:xx:cluster/prod-01
user:
exec:
apiVersion: client.authentication.k8s.io/v1beta1
args:
- --region
- us-east-1
- eks
- get-token
- --cluster-name
- prod-01
command: aws
env:
- name: AWS_PROFILE
value: ptr
interactiveMode: IfAvailable
provideClusterInfo: false
$ kubectl --kubeconfig kubeconfig cluster-info
Kubernetes control plane is running at https://xx.xx.us-east-1.eks.amazonaws.com
CoreDNS is running at https://xx.xx.us-east-1.eks.amazonaws.com/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
$ kpt version
1.0.0-beta.21
$ kpt --kubeconfig kubeconfig live install-resource-group
installing inventory ResourceGroup CRD...fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x23130 pc=0x23130]
runtime stack:
runtime.throw({0x28bf079?, 0x4fd3440?})
/usr/local/go/src/runtime/panic.go:992 +0x71
runtime.sigpanic()
/usr/local/go/src/runtime/signal_unix.go:802 +0x3a9
goroutine 38 [syscall]:
runtime.cgocall(0x19ab710, 0xc001840598)
/usr/local/go/src/runtime/cgocall.go:157 +0x5c fp=0xc001840570 sp=0xc001840538 pc=0x44f21c
net._C2func_getaddrinfo(0xc002225400, 0x0, 0xc000d8d860, 0xc001087cf0)
_cgo_gotypes.go:94 +0x56 fp=0xc001840598 sp=0xc001840570 pc=0x64a856
net.cgoLookupIPCNAME.func1({0xc002225400, 0x0?, 0x6120000000000000?}, 0xc002225360?, 0x65111b?)
/usr/local/go/src/net/cgo_unix.go:160 +0x9f fp=0xc0018405f0 sp=0xc001840598 pc=0x64c57f
net.cgoLookupIPCNAME({0x287416c, 0x3}, {0xc002225360, 0x40})
/usr/local/go/src/net/cgo_unix.go:160 +0x16d fp=0xc001840738 sp=0xc0018405f0 pc=0x64bded
net.cgoIPLookup(0x3e616f0?, {0x287416c?, 0xc0022253b0?}, {0xc002225360?, 0xc0000d58c0?})
/usr/local/go/src/net/cgo_unix.go:217 +0x3b fp=0xc0018407a8 sp=0xc001840738 pc=0x64c63b
net.cgoLookupIP.func1()
/usr/local/go/src/net/cgo_unix.go:227 +0x36 fp=0xc0018407e0 sp=0xc0018407a8 pc=0x64ca76
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc0018407e8 sp=0xc0018407e0 pc=0x4b1e81
created by net.cgoLookupIP
/usr/local/go/src/net/cgo_unix.go:227 +0x12a
goroutine 1 [select]:
net/http.(*Transport).getConn(0xc00172cc80, 0xc001811200, {{}, 0x0, {0xc0017726e0, 0x5}, {0xc002225360, 0x44}, 0x0})
/usr/local/go/src/net/http/transport.go:1375 +0x5c6
net/http.(*Transport).roundTrip(0xc00172cc80, 0xc0018df300)
/usr/local/go/src/net/http/transport.go:581 +0x76f
net/http.(*Transport).RoundTrip(0x271fb20?, 0xc000d8c6f0?)
/usr/local/go/src/net/http/roundtrip.go:17 +0x19
k8s.io/client-go/plugin/pkg/client/auth/exec.(*roundTripper).RoundTrip(0xc0016871d0, 0xc0018df300)
/go/pkg/mod/k8s.io/client-go@v0.24.0/plugin/pkg/client/auth/exec/exec.go:344 +0x1e4
sigs.k8s.io/cli-utils/pkg/flowcontrol.IsEnabled({0x2c37e70, 0xc00077f500}, 0xc0019406c0)
/go/pkg/mod/sigs.k8s.io/cli-utils@v0.33.0/pkg/flowcontrol/flowcontrol.go:64 +0x33f
github.com/GoogleContainerTools/kpt/commands/util.UpdateQPS.func1(0xc0019406c0)
/go/src/github.com/GoogleContainerTools/kpt/commands/util/factory.go:64 +0x8e
k8s.io/cli-runtime/pkg/genericclioptions.(*ConfigFlags).ToRESTConfig(0xc001794f00)
/go/pkg/mod/k8s.io/cli-runtime@v0.24.0/pkg/genericclioptions/config_flags.go:140 +0x42
k8s.io/cli-runtime/pkg/genericclioptions.(*ConfigFlags).toDiscoveryClient(0xc001794f00)
/go/pkg/mod/k8s.io/cli-runtime@v0.24.0/pkg/genericclioptions/config_flags.go:270 +0x33
k8s.io/cli-runtime/pkg/genericclioptions.(*ConfigFlags).toPersistentDiscoveryClient(0xc001794f00)
/go/pkg/mod/k8s.io/cli-runtime@v0.24.0/pkg/genericclioptions/config_flags.go:260 +0xa7
k8s.io/cli-runtime/pkg/genericclioptions.(*ConfigFlags).ToDiscoveryClient(0x29?)
/go/pkg/mod/k8s.io/cli-runtime@v0.24.0/pkg/genericclioptions/config_flags.go:250 +0x25
k8s.io/cli-runtime/pkg/genericclioptions.(*ConfigFlags).toRESTMapper(0xc0000021a0?)
/go/pkg/mod/k8s.io/cli-runtime@v0.24.0/pkg/genericclioptions/config_flags.go:314 +0x1d
k8s.io/cli-runtime/pkg/genericclioptions.(*ConfigFlags).toPersistentRESTMapper(0xc001794f00)
/go/pkg/mod/k8s.io/cli-runtime@v0.24.0/pkg/genericclioptions/config_flags.go:304 +0xa7
k8s.io/cli-runtime/pkg/genericclioptions.(*ConfigFlags).ToRESTMapper(0x52c864?)
/go/pkg/mod/k8s.io/cli-runtime@v0.24.0/pkg/genericclioptions/config_flags.go:294 +0x25
github.com/GoogleContainerTools/kpt/internal/util/cfgflags.(*UserAgentKubeConfigFlags).ToRESTMapper(0x0?)
/go/src/github.com/GoogleContainerTools/kpt/internal/util/cfgflags/useragent.go:46 +0x22
k8s.io/kubectl/pkg/cmd/util.(*factoryImpl).ToRESTMapper(0x29?)
/go/pkg/mod/k8s.io/kubectl@v0.24.0/pkg/cmd/util/factory_client_access.go:66 +0x22
github.com/GoogleContainerTools/kpt/pkg/status.NewStatusPoller({0x2c40e20, 0xc001810100})
/go/src/github.com/GoogleContainerTools/kpt/pkg/status/poller.go:29 +0x3f
github.com/GoogleContainerTools/kpt/pkg/live.(*ResourceGroupInstaller).InstallRG(0xc002195c88, {0x2c37ea8, 0xc000cf0300})
/go/src/github.com/GoogleContainerTools/kpt/pkg/live/inventoryrg.go:422 +0x50
github.com/GoogleContainerTools/kpt/commands/live/installrg.(*Runner).runE(0xc00077eba0, 0x0?, {0xc001896720?, 0x0?, 0x0?})
/go/src/github.com/GoogleContainerTools/kpt/commands/live/installrg/cmdinstallrg.go:80 +0x97
github.com/spf13/cobra.(*Command).execute(0xc001824500, {0xc001896700, 0x2, 0x2})
/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:872 +0x694
github.com/spf13/cobra.(*Command).ExecuteC(0xc0016bf400)
/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:990 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:918
k8s.io/component-base/cli.run(0xc0016bf400)
/go/pkg/mod/k8s.io/component-base@v0.24.0/cli/run.go:146 +0x305
k8s.io/component-base/cli.RunNoErrOutput(...)
/go/pkg/mod/k8s.io/component-base@v0.24.0/cli/run.go:84
main.runMain()
/go/src/github.com/GoogleContainerTools/kpt/main.go:61 +0x45
main.main()
/go/src/github.com/GoogleContainerTools/kpt/main.go:45 +0x19
goroutine 5 [sleep]:
time.Sleep(0x6fc23ac00)
/usr/local/go/src/runtime/time.go:194 +0x12e
sigs.k8s.io/controller-runtime/pkg/log.init.0.func1()
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.1/pkg/log/log.go:63 +0x38
created by sigs.k8s.io/controller-runtime/pkg/log.init.0
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.1/pkg/log/log.go:62 +0x25
goroutine 36 [select]:
net.(*Resolver).lookupIPAddr(0x3e616e0, {0x2c37e70?, 0xc00077f500}, {0x287416c, 0x3}, {0xc002225360, 0x40})
/usr/local/go/src/net/lookup.go:325 +0x51b
net.(*Resolver).internetAddrList(0x2c37e70?, {0x2c37e70?, 0xc00077f500?}, {0x287416c, 0x3}, {0xc002225360?, 0x44?})
/usr/local/go/src/net/ipsock.go:288 +0x67a
net.(*Resolver).resolveAddrList(0x3e9cb58?, {0x2c37e70, 0xc00077f500}, {0x2874a08, 0x4}, {0x287416c?, 0xc00009a7b8?}, {0xc002225360, 0x44}, {0x0, ...})
/usr/local/go/src/net/dial.go:221 +0x41b
net.(*Dialer).DialContext(0xc00077f560, {0x2c37e70, 0xc00077f500}, {0x287416c, 0x3}, {0xc002225360, 0x44})
/usr/local/go/src/net/dial.go:406 +0x448
k8s.io/client-go/util/connrotation.(*Dialer).DialContext(0xc001604860, {0x2c37e70?, 0xc00077f500?}, {0x287416c?, 0x1898a9b3a68?}, {0xc002225360?, 0x118?})
/go/pkg/mod/k8s.io/client-go@v0.24.0/util/connrotation/connrotation.go:118 +0x48
net/http.(*Transport).dial(0xc00009aa18?, {0x2c37e70?, 0xc00077f500?}, {0x287416c?, 0x0?}, {0xc002225360?, 0xc00009aa68?})
/usr/local/go/src/net/http/transport.go:1169 +0xda
net/http.(*Transport).dialConn(0xc00172cc80, {0x2c37e70, 0xc00077f500}, {{}, 0x0, {0xc0017726e0, 0x5}, {0xc002225360, 0x44}, 0x0})
/usr/local/go/src/net/http/transport.go:1607 +0x83f
net/http.(*Transport).dialConnFor(0x0?, 0xc0000d58c0)
/usr/local/go/src/net/http/transport.go:1449 +0xb0
created by net/http.(*Transport).queueForDial
/usr/local/go/src/net/http/transport.go:1418 +0x3d2
goroutine 37 [select]:
net.cgoLookupIP({0x2c37e00, 0xc001811280}, {0x287416c, 0x3}, {0xc002225360, 0x40})
/usr/local/go/src/net/cgo_unix.go:228 +0x1aa
net.(*Resolver).lookupIP(0x3e616e0, {0x2c37e00, 0xc001811280}, {0x287416c, 0x3}, {0xc002225360, 0x40})
/usr/local/go/src/net/lookup_unix.go:96 +0x128
net.glob..func1({0x2c37e00?, 0xc001811280?}, 0x0?, {0x287416c?, 0x0?}, {0xc002225360?, 0x7ea7b0?})
/usr/local/go/src/net/hook.go:23 +0x3d
net.(*Resolver).lookupIPAddr.func1()
/usr/local/go/src/net/lookup.go:319 +0x9f
internal/singleflight.(*Group).doCall(0x3e616f0, 0xc00077aff0, {0xc0022253b0, 0x44}, 0xc0000d58c0?)
/usr/local/go/src/internal/singleflight/singleflight.go:95 +0x3b
created by internal/singleflight.(*Group).DoChan
/usr/local/go/src/internal/singleflight/singleflight.go:88 +0x2ec
I'm able to use kubectl
just fine.
Another thing to consider, I'm able to spin up a vanilla kind
cluster locally and can use kpt
against it just fine.
After some google-fu, I was able to resolve this by forcing the Go runtime to use the builtin DNS resolver (instead of cgo
):
GODEBUG=netdns=go kpt live install-resource-group
Any ideas on how to make this the default? Not sure if this the root cause or addressing the actual issue in a round about way.
Which version of kpt are you using? With the kpt built from HEAD of the repo, I'm unable to reproduce this issue. I'm getting:
$ kpt alpha rpkg get Error: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused
This is using kpt version 1.0.0-beta.23
.
The first time you execute kpt alpha rpkg get
I do see the same connect: connection refused
message you see, and then every time afterwards I see fatal error: unexpected signal
ubuntu@nephio-poc-002:~$ kpt alpha rpkg get
Error: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
ubuntu@nephio-poc-002:~$ kpt alpha rpkg get
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x63 pc=0x7fb7a85e95ca]
runtime stack:
runtime.throw({0x28d0e89?, 0x7fb674000d53?})
/usr/local/go/src/runtime/panic.go:992 +0x71
runtime.sigpanic()
/usr/local/go/src/runtime/signal_unix.go:802 +0x3a9
...
ubuntu@nephio-poc-002:~$ kpt version
1.0.0-beta.23
With verbose logging:
ubuntu@nephio-poc-002:~$ kpt -v 9 alpha rpkg get
I1115 21:07:21.007498 463327 round_trippers.go:466] curl -v -XGET -H "Accept: application/json, */*" -H "User-Agent: kpt/1.0.0-beta.23" 'http://localhost:8080/api?timeout=32s'
I1115 21:07:21.008988 463327 round_trippers.go:495] HTTP Trace: DNS Lookup for localhost resolved to [{127.0.0.1 }]
I1115 21:07:21.009289 463327 round_trippers.go:508] HTTP Trace: Dial to tcp:127.0.0.1:8080 failed: dial tcp 127.0.0.1:8080: connect: connection refused
I1115 21:07:21.009347 463327 round_trippers.go:553] GET http://localhost:8080/api?timeout=32s in 1 milliseconds
I1115 21:07:21.009368 463327 round_trippers.go:570] HTTP Statistics: DNSLookup 0 ms Dial 0 ms TLSHandshake 0 ms Duration 1 ms
I1115 21:07:21.009387 463327 round_trippers.go:577] Response Headers:
I1115 21:07:21.009496 463327 cached_discovery.go:119] skipped caching discovery info due to Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
I1115 21:07:21.009561 463327 shortcut.go:89] Error loading discovery information: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
I1115 21:07:21.009661 463327 round_trippers.go:466] curl -v -XGET -H "Accept: application/json, */*" -H "User-Agent: kpt/1.0.0-beta.23" 'http://localhost:8080/api?timeout=32s'
I1115 21:07:21.009836 463327 round_trippers.go:495] HTTP Trace: DNS Lookup for localhost resolved to [{127.0.0.1 }]
I1115 21:07:21.010055 463327 round_trippers.go:508] HTTP Trace: Dial to tcp:127.0.0.1:8080 failed: dial tcp 127.0.0.1:8080: connect: connection refused
I1115 21:07:21.010160 463327 round_trippers.go:553] GET http://localhost:8080/api?timeout=32s in 0 milliseconds
I1115 21:07:21.010187 463327 round_trippers.go:570] HTTP Statistics: DNSLookup 0 ms Dial 0 ms TLSHandshake 0 ms Duration 0 ms
I1115 21:07:21.010204 463327 round_trippers.go:577] Response Headers:
I1115 21:07:21.010304 463327 cached_discovery.go:119] skipped caching discovery info due to Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
I1115 21:07:21.010436 463327 round_trippers.go:466] curl -v -XGET -H "Accept: application/json, */*" -H "User-Agent: kpt/1.0.0-beta.23" 'http://localhost:8080/api?timeout=32s'
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x63 pc=0x7fa3802975ca]
Yeah, I can reproduce this when I'm using the kpt 1.0.0-beta.23 binary, but not if I'm building it from source.
The binary downloadable off of the kpt GitHub, or just the one on the Nephio PoC VM?
I can reproduce it on my own linux machine with the binary downloaded from GitHub.
Expected behavior
No crashing
Actual behavior
Steps to reproduce the behavior
kpt alpha rpkg get
with no kubeconfig file on the system. Also happens withkpt live apply
. Works if there is a kubeconfig in a non-standard place and you use--kubeconfig
.