Closed gao-feng closed 6 years ago
Got a bug during testing, not sure if related:
$ sudo runv interface add --name eth --ip 192.168.0.2/24 --mac aa:bb:cc:dd:ee:aa --mtu 1400 busybox
E1011 16:25:52.463909 3433 qmp_handler.go:314] QMP command failed: unknown
E1011 16:25:52.464534 3433 network.go:172] SB[vm-NWLTJPKyVJ] interface creation failed: &hypervisor.NetDevInsertedEvent{Id:"0", Index:0, DeviceName:"eth0", Address:5}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x86e0fb]
goroutine 1 [running]:
github.com/hyperhq/runv/hypervisor.(*VmContext).dump(0xc42007bb80, 0x0, 0x0, 0x0)
/tmp/gopath.YSwXKR/src/github.com/hyperhq/runv/hypervisor/persistence.go:124 +0xa1b
github.com/hyperhq/runv/hypervisor.(*Vm).Dump(0xc420018af0, 0x0, 0x0, 0x1000100, 0x0, 0xffffffffffffffff)
/tmp/gopath.YSwXKR/src/github.com/hyperhq/runv/hypervisor/vm.go:746 +0x33
main.releaseAndUnlockSandbox(0xc420018af0, 0xc42000e130, 0x1, 0x1)
/tmp/gopath.YSwXKR/src/github.com/hyperhq/runv/cli/sandbox.go:167 +0x40
main.putSandbox(0xc420018af0, 0xc42000e130)
/tmp/gopath.YSwXKR/src/github.com/hyperhq/runv/cli/sandbox.go:192 +0x55
main.vmByContainerID.func1()
/tmp/gopath.YSwXKR/src/github.com/hyperhq/runv/cli/interface.go:211 +0x33
main.glob..func7(0xc4200f8b40, 0xf33ea0, 0xc4202268a0)
/tmp/gopath.YSwXKR/src/github.com/hyperhq/runv/cli/interface.go:73 +0x2c6
github.com/hyperhq/runv/vendor/github.com/urfave/cli.HandleAction(0x99de40, 0xa8f8c8, 0xc4200f8b40, 0xc420068700, 0x0)
/tmp/gopath.YSwXKR/src/github.com/hyperhq/runv/vendor/github.com/urfave/cli/app.go:485 +0xd4
github.com/hyperhq/runv/vendor/github.com/urfave/cli.Command.Run(0xa67a3f, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa7c60f, 0x21, 0x0, ...)
/tmp/gopath.YSwXKR/src/github.com/hyperhq/runv/vendor/github.com/urfave/cli/command.go:207 +0xb6e
github.com/hyperhq/runv/vendor/github.com/urfave/cli.(*App).RunAsSubcommand(0xc4200fb040, 0xc4200f88c0, 0x0, 0x0)
/tmp/gopath.YSwXKR/src/github.com/hyperhq/runv/vendor/github.com/urfave/cli/app.go:374 +0xacc
github.com/hyperhq/runv/vendor/github.com/urfave/cli.Command.startApp(0xa6ccf7, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa7b560, 0x1f, 0x0, ...)
/tmp/gopath.YSwXKR/src/github.com/hyperhq/runv/vendor/github.com/urfave/cli/command.go:293 +0x8a3
github.com/hyperhq/runv/vendor/github.com/urfave/cli.Command.Run(0xa6ccf7, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa7b560, 0x1f, 0x0, ...)
/tmp/gopath.YSwXKR/src/github.com/hyperhq/runv/vendor/github.com/urfave/cli/command.go:93 +0x14c3
github.com/hyperhq/runv/vendor/github.com/urfave/cli.(*App).Run(0xc4200fab60, 0xc4200100c0, 0xc, 0xc, 0x0, 0x0)
/tmp/gopath.YSwXKR/src/github.com/hyperhq/runv/vendor/github.com/urfave/cli/app.go:250 +0x7d0
main.main()
/tmp/gopath.YSwXKR/src/github.com/hyperhq/runv/cli/main.go:144 +0xf77
@WeiZhang555
oops, nic may be nil now, can you try below patch? thanks!
diff --git a/hypervisor/persistence.go b/hypervisor/persistence.go
index e9fa9a8..10ca642 100644
--- a/hypervisor/persistence.go
+++ b/hypervisor/persistence.go
@@ -120,6 +120,9 @@ func (ctx *VmContext) dump() (*PersistInfo, error) {
}
nc.slotLock.RLock()
for _, nic := range nc.eth {
+ if nic == nil {
+ continue
+ }
Let me have a check now...
Oops, another one. I think it's same problem.
$ sudo runv delete -f busybox
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x86f167]
goroutine 1 [running]:
github.com/hyperhq/runv/hypervisor.(*NetworkContext).load(0xc420018d70, 0xc42007aa00)
/tmp/gopath.fYmGYj/src/github.com/hyperhq/runv/hypervisor/persistence.go:218 +0x167
github.com/hyperhq/runv/hypervisor.(*PersistInfo).vmContext(0xc42007aa00, 0xc420064840, 0xc4200648a0, 0xd, 0x1, 0x0)
/tmp/gopath.fYmGYj/src/github.com/hyperhq/runv/hypervisor/persistence.go:276 +0x2bd
And I still can't add interface:
$ sudo runv interface add --name eth1 --ip 192.168.0.2/24 --mac aa:bb:cc:dd:ee:aa --mtu 1400 busybox
E1011 16:44:42.887509 7060 qmp_handler.go:314] QMP command failed: unknown
E1011 16:44:42.887927 7060 network.go:172] SB[vm-jSZjJtNhkO] interface creation failed: &hypervisor.NetDevInsertedEvent{Id:"0", Index:0, DeviceName:"eth0", Address:5}
E1011 16:44:43.011206 7060 main.go:145] app.Run(os.Args) failed with err: &errors.errorString{s:"allocate device failed"}
allocate device failed
more complicated than I thought, need more time to think this refactor. close it now.
Signed-off-by: Gao feng omarapazanadi@gmail.com