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

Fix unexpected nil pointer when reading item from keyring #470

Merged
merged 1 commit into from
Feb 20, 2021

Conversation

zymap
Copy link
Member

@zymap zymap commented Feb 20, 2021

Motivation

When compiling the code across different platform, sometimes
will encounter the nil pointer when getting the label from the
authIterm.

error logs:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x13105e1]

goroutine 1 [running]:
github.com/apache/pulsar-client-go/oauth2/store.(*KeyringStore).WhoAmI(0xc0001ae660, 0x7ffeefbff459, 0x1b, 0x0, 0x0, 0x0, 0x0)
	/Users/zhangyong/github.com/apache/pulsar-client-go/oauth2/store/keyring.go:127 +0x221
github.com/streamnative/pulsarctl/pkg/oauth2.doActivate(0xc0003446e0, 0x7ffeefbff3ae, 0x3a, 0x7ffeefbff459, 0x1b, 0x7ffeefbff421, 0x2c, 0xc000357cf8, 0x157a745)
	/Users/zhangyong/github.com/streamnative/pulsarctl/pkg/oauth2/active.go:93 +0x21a
github.com/streamnative/pulsarctl/pkg/oauth2.activateCmd.func1(0x1492580, 0xc000357d08)
	/Users/zhangyong/github.com/streamnative/pulsarctl/pkg/oauth2/active.go:52 +0x69
github.com/streamnative/pulsarctl/pkg/cmdutils.run(0xc000329d10)
	/Users/zhangyong/github.com/streamnative/pulsarctl/pkg/cmdutils/verb.go:100 +0x27
github.com/streamnative/pulsarctl/pkg/cmdutils.(*VerbCmd).SetRunFunc.func1(0xc000361180, 0xc0002bcd80, 0x0, 0x8)
	/Users/zhangyong/github.com/streamnative/pulsarctl/pkg/cmdutils/verb.go:67 +0x2a
github.com/spf13/cobra.(*Command).execute(0xc000361180, 0xc0002bcc00, 0x8, 0x8, 0xc000361180, 0xc0002bcc00)
	/Users/zhangyong/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:830 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0xc00016c280, 0xc000339260, 0xc00001e0c0, 0xa)
	/Users/zhangyong/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914 +0x30b
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/zhangyong/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
main.main()
	/Users/zhangyong/github.com/streamnative/pulsarctl/main.go:41 +0x1c5

@zymap zymap self-assigned this Feb 20, 2021
@zymap zymap added this to the 0.5.0 milestone Feb 20, 2021
@zymap zymap requested a review from wolfstudy February 20, 2021 08:28
Copy link
Member

@wolfstudy wolfstudy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1

@zymap zymap merged commit af91e9c into apache:master Feb 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants