gravitl / netmaker

Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks.
https://netmaker.io
Other
9.52k stars 552 forks source link

[Bug]: netclient 0.17.1 panic runtime error: index out of range [1] with length 0 #2146

Closed cdpb closed 1 year ago

cdpb commented 1 year ago

Contact Details

anders.halman+github@gmail.com

What happened?

I am running netmaker since 5 months on 0.16.3. Yesterday I updated everything on 0.17.1. 5 out of 6 clients updated fine and reconnected to the api. One client is still having issues.

There are two other clients within the same physical network without problems.

running on debian 11, installed via netclient repo.

things I did:

all the same outcome.

Version

v0.17.1

What OS are you using?

Linux

Relevant log output

> Mar 26 16:24:50 pve.fritz.box systemd[1]: Started Netclient Daemon.
Mar 26 16:24:50 pve.fritz.box netclient[223756]: [netclient] 2023-03-26 16:24:50 [daemon.go-42] Daemon(): netclient daemon started -- version: v0.17.1
Mar 26 16:24:50 pve.fritz.box netclient[223756]: [netclient] 2023-03-26 16:24:50 [clientconfig.go-23] UpdateClientConfig(): checking for netclient updates...
Mar 26 16:24:50 pve.fritz.box netclient[223756]: [netclient] 2023-03-26 16:24:50 [clientconfig.go-52] UpdateClientConfig(): finished updates
Mar 26 16:24:50 pve.fritz.box netclient[223756]: [netclient] 2023-03-26 16:24:50 [daemon.go-92] startGoRoutines(): initializing network mesh
Mar 26 16:24:50 pve.fritz.box netclient[223756]: [netclient] 2023-03-26 16:24:50 [daemon.go-109] startGoRoutines(): started daemon for server  broker.nm.xxx
Mar 26 16:24:50 pve.fritz.box netclient[223756]: [netclient] 2023-03-26 16:24:50 [mqpublish.go-30] Checkin(): starting checkin goroutine
Mar 26 16:24:50 pve.fritz.box netclient[223756]: [netclient] 2023-03-26 16:24:50 [daemon.go-194] messageQueue(): network: mesh netclient message queue started for server: broker.nm.xxx
Mar 26 16:24:50 pve.fritz.box netclient[223756]: [netclient] 2023-03-26 16:24:50 [daemon.go-156] setSubscriptions(): subscribed to node updates for node pvefritzbox update/mesh/dfcc684a-3939-4f25-95db-aec625e7c8e9
Mar 26 16:24:50 pve.fritz.box netclient[223756]: [netclient] 2023-03-26 16:24:50 [daemon.go-161] setSubscriptions(): subscribed to peer updates for node pvefritzbox peers/mesh/dfcc684a-3939-4f25-95db-aec625e7c8e9
Mar 26 16:24:50 pve.fritz.box netclient[223756]: [netclient] 2023-03-26 16:24:50 [mqhandlers.go-249] UpdatePeers(): network: mesh received peer update for node pvefritzbox mesh
Mar 26 16:24:50 pve.fritz.box netclient[223756]: panic: runtime error: index out of range [1] with length 0
Mar 26 16:24:50 pve.fritz.box netclient[223756]: goroutine 11 [running]:
Mar 26 16:24:50 pve.fritz.box netclient[223756]: github.com/guumaster/hostctl/pkg/parser.parseRouteLine({0xe6f260?, 0xc00055b069?})
Mar 26 16:24:50 pve.fritz.box netclient[223756]:         /home/runner/go/pkg/mod/github.com/guumaster/hostctl@v1.1.3/pkg/parser/parser.go:146 +0x252
Mar 26 16:24:50 pve.fritz.box netclient[223756]: github.com/guumaster/hostctl/pkg/parser.parseToDefault({0xc00055b07c, 0x1, 0xf84}, {0x0?, 0x7?})
Mar 26 16:24:50 pve.fritz.box netclient[223756]:         /home/runner/go/pkg/mod/github.com/guumaster/hostctl@v1.1.3/pkg/parser/parser.go:102 +0x6e
Mar 26 16:24:50 pve.fritz.box netclient[223756]: github.com/guumaster/hostctl/pkg/parser.Parse({0xb16e40, 0xc0004b2000})
Mar 26 16:24:50 pve.fritz.box netclient[223756]:         /home/runner/go/pkg/mod/github.com/guumaster/hostctl@v1.1.3/pkg/parser/parser.go:67 +0x48a
Mar 26 16:24:50 pve.fritz.box netclient[223756]: github.com/guumaster/hostctl/pkg/file.NewWithFs({0xa2f4b6?, 0xc0004abb20?}, {0xb1dd20?, 0xeda6c8?})
Mar 26 16:24:50 pve.fritz.box netclient[223756]:         /home/runner/go/pkg/mod/github.com/guumaster/hostctl@v1.1.3/pkg/file/file.go:44 +0x112
Mar 26 16:24:50 pve.fritz.box netclient[223756]: github.com/guumaster/hostctl/pkg/file.NewFile(...)
Mar 26 16:24:50 pve.fritz.box netclient[223756]:         /home/runner/go/pkg/mod/github.com/guumaster/hostctl@v1.1.3/pkg/file/file.go:27
Mar 26 16:24:50 pve.fritz.box netclient[223756]: github.com/gravitl/netmaker/netclient/functions.setHostDNS({0xc000002900, 0xb2}, {0xc0004b5358, 0x7}, 0x0)
Mar 26 16:24:50 pve.fritz.box netclient[223756]:         /home/runner/work/netmaker/netmaker/netclient/functions/mqhandlers.go:286 +0x2ab
Mar 26 16:24:50 pve.fritz.box netclient[223756]: github.com/gravitl/netmaker/netclient/functions.UpdatePeers({0x98b7a0?, 0x0?}, {0xb1cb40, 0xc0000d4730})
Mar 26 16:24:50 pve.fritz.box netclient[223756]:         /home/runner/work/netmaker/netmaker/netclient/functions/mqhandlers.go:251 +0x78f
Mar 26 16:24:50 pve.fritz.box netclient[223756]: github.com/eclipse/paho%2emqtt%2egolang.(*router).matchAndDispatch.func2()
Mar 26 16:24:50 pve.fritz.box netclient[223756]:         /home/runner/go/pkg/mod/github.com/eclipse/paho.mqtt.golang@v1.4.2/router.go:218 +0x8d5
Mar 26 16:24:50 pve.fritz.box netclient[223756]: created by github.com/eclipse/paho%2emqtt%2egolang.(*router).matchAndDispatch
Mar 26 16:24:50 pve.fritz.box netclient[223756]:         /home/runner/go/pkg/mod/github.com/eclipse/paho.mqtt.golang@v1.4.2/router.go:173 +0x26a
Mar 26 16:24:50 pve.fritz.box systemd[1]: netclient.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Mar 26 16:24:50 pve.fritz.box systemd[1]: netclient.service: Failed with result 'exit-code'.

Contributing guidelines

cdpb commented 1 year ago

There was a whitespace in the /etc/hosts file, hence it crashed.

check with vi /etc/hosts :set list, remove whitespace, restart netclient