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

rpk: segfault on errors in topic add-partitions #5351

Closed
jcsp opened this issue Jul 5, 2022 · 2 comments · Fixed by #5369
Closed

rpk: segfault on errors in topic add-partitions #5351

jcsp opened this issue Jul 5, 2022 · 2 comments · Fixed by #5369
Assignees
Labels
area/rpk kind/bug Something isn't working

Comments

@jcsp
Copy link
Contributor

jcsp commented Jul 5, 2022

Testing with tip of dev on a system with lots of partitions.

$ rpk topic add-partitions scale_10k -n20000
TOPIC  ERROR
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xc4aecf]

goroutine 1 [running]:
github.com/redpanda-data/redpanda/src/go/rpk/pkg/cli/cmd/topic.NewAddPartitionsCommand.func1(0xc000493680, {0xc0004c0680, 0x1, 0x2})
	/home/vectorized/redpanda/src/go/rpk/pkg/cli/cmd/topic/add_partitions.go:65 +0x48f
github.com/spf13/cobra.(*Command).execute(0xc000493680, {0xc0004c0660, 0x2, 0x2})
	/home/vectorized/redpanda/vbuild/go/1.17.8/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:856 +0x5f8
github.com/spf13/cobra.(*Command).ExecuteC(0xc000458f00)
	/home/vectorized/redpanda/vbuild/go/1.17.8/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:960 +0x3ad
github.com/spf13/cobra.(*Command).Execute(...)
	/home/vectorized/redpanda/vbuild/go/1.17.8/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:897
github.com/redpanda-data/redpanda/src/go/rpk/pkg/cli/cmd.Execute()
	/home/vectorized/redpanda/src/go/rpk/pkg/cli/cmd/root.go:117 +0x630
main.main()
	/home/vectorized/redpanda/src/go/rpk/cmd/rpk/main.go:15 +0x17

Looks like this is a null pointer dereference on err, where it means to read e.

@jcsp jcsp added kind/bug Something isn't working area/rpk labels Jul 5, 2022
@jcsp
Copy link
Contributor Author

jcsp commented Jul 6, 2022

Would be interested to see what a regression test looks like for this -- I can imagine a short ducktape test that e.g. tries to add an unfeasible number of partitions to generate an error, but maybe there's enough unit testing infrastructure to do it that way.

@twmb
Copy link
Contributor

twmb commented Jul 6, 2022

This is a simple bug that uses the wrong variable internally, where the variable is nil but the one it's meant to be using is not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rpk kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants