gocsi icon indicating copy to clipboard operation
gocsi copied to clipboard

Panic in controller/expand-volume

Open dr0pdb opened this issue 4 years ago • 2 comments

Summary

Upon using controller/expand-volume command without the --cap option as shown below, the program panics:

┌[satiwa☮MININT-UMBS8MU]-(/mnt/c/Users/satiwa)
└> csc controller expand-volume --endpoint tcp://127.0.0.1:10000 --req-bytes 2147483648 "k8s#fusec2151e57321d480c8f7#csivolumename"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x86865d]

goroutine 1 [running]:
github.com/rexray/gocsi/csc/cmd.glob..func6(0xd177c0, 0xc0000c8870, 0x1, 0x5, 0x0, 0x0)
        /home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/rexray/gocsi/csc/cmd/controller_expand_volume.go:33 +0x5d
github.com/spf13/cobra.(*Command).execute(0xd177c0, 0xc0000c8820, 0x5, 0x5, 0xd177c0, 0xc0000c8820)
        /home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/spf13/cobra/command.go:850 +0x47c
github.com/spf13/cobra.(*Command).ExecuteC(0xd1aee0, 0x1, 0x99cc88, 0x13b)
        /home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/spf13/cobra/command.go:958 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
        /home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/spf13/cobra/command.go:895
github.com/rexray/gocsi/csc/cmd.Execute()
        /home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/rexray/gocsi/csc/cmd/root.go:165 +0x3f
main.main()
        /home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/rexray/gocsi/csc/main.go:6 +0x25

This seems to happen on this line.

Upon passing the --cap flag, the program panics again with the following error:

┌[satiwa☮MININT-UMBS8MU]-(/mnt/c/Users/satiwa)
└> csc controller expand-volume --endpoint tcp://127.0.0.1:10000 --cap 1,block --req-bytes 2147483648
"k8s#fusec2151e57321d480c8f7#csivolumename"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x866e9c]

goroutine 1 [running]:
github.com/rexray/gocsi/csc/cmd.(*volumeCapabilitySliceArg).Set(0x0, 0x7ffd6e6baaa1, 0x7, 0x3, 0xc000127e98)
        /home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/rexray/gocsi/csc/cmd/vartypes.go:96 +0x5dc
github.com/spf13/pflag.(*FlagSet).Set(0xc000268500, 0x97c308, 0x3, 0x7ffd6e6baaa1, 0x7, 0x7ffd6e6baa9d, 0xc000127e10)
        /home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/spf13/pflag/flag.go:470 +0xe2
github.com/spf13/pflag.(*FlagSet).Parse.func1(0xc0001e2e60, 0x7ffd6e6baaa1, 0x7, 0x3, 0xc000127e98)
        /home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/spf13/pflag/flag.go:1145 +0x54
github.com/spf13/pflag.(*FlagSet).parseLongArg(0xc000268500, 0x7ffd6e6baa9b, 0x5, 0xc0001e1ca0, 0x4, 0x4, 0xc0001edcb8, 0xc0001e1c90, 0x5, 0x5, ...)
        /home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/spf13/pflag/flag.go:1007 +0x28b
github.com/spf13/pflag.(*FlagSet).parseArgs(0xc000268500, 0xc0001e1ca0, 0x4, 0x7, 0xc0001edcb8, 0x8204f8, 0xc000269700)
        /home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/spf13/pflag/flag.go:1115 +0x479
github.com/spf13/pflag.(*FlagSet).Parse(0xc000268500, 0xc0001e1c70, 0x7, 0x7, 0x0, 0xc000141460)
        /home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/spf13/pflag/flag.go:1148 +0x13d
github.com/spf13/cobra.(*Command).ParseFlags(0xd177c0, 0xc0001e1c70, 0x7, 0x7, 0x7ffd6e6baa61, 0xd16aa0)
        /home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/spf13/cobra/command.go:1623 +0xbf
github.com/spf13/cobra.(*Command).execute(0xd177c0, 0xc0001e1c70, 0x7, 0x7, 0xd177c0, 0xc0001e1c70)
        /home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/spf13/cobra/command.go:777 +0xae
github.com/spf13/cobra.(*Command).ExecuteC(0xd1aee0, 0x1, 0x99cc88, 0x13b)
        /home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/spf13/cobra/command.go:958 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
        /home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/spf13/cobra/command.go:895
github.com/rexray/gocsi/csc/cmd.Execute()
        /home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/rexray/gocsi/csc/cmd/root.go:165 +0x3f
main.main()
        /home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/rexray/gocsi/csc/main.go:6 +0x25

Expected Behavior

Shouldn't panic with and without --cap.

Actual Behavior

Panics

dr0pdb avatar Dec 06 '20 15:12 dr0pdb

@dr0pdb there's a fix for this bug: https://github.com/rexray/gocsi/pull/142

Can you try it out and see if it fixed the problem for you?

xing-yang avatar Dec 08 '20 05:12 xing-yang

@xing-yang ~Yeah it fixed it.~

Nope, it didn't work. Commented on the PR.

dr0pdb avatar Dec 08 '20 15:12 dr0pdb