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: not initialized sets.String cause panic #733

Merged
merged 1 commit into from
Feb 10, 2022

Conversation

DrmagicE
Copy link
Member

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:
/kind bug
/kind documentation
/kind enhancement
/kind good-first-issue
/kind feature
/kind question
/kind design
/sig ai
/sig iot
/sig network
/sig storage
/sig storage

/kind bug

What this PR does / why we need it:

TheignoreErrors (a map) param is not initialized before using so it will cause panic when useyurtctl join with the flag--ignore-preflight-errors set.

panic: assignment to entry in nil map

goroutine 1 [running]:
k8s.io/apimachinery/pkg/util/sets.String.Insert(0x0, 0xc00063fba0, 0x1, 0x1, 0xc0000a5440)
        /usr/local/gopath/pkg/mod/k8s.io/apimachinery@v0.20.12-rc.0/pkg/util/sets/string.go:51 +0x78
github.com/openyurtio/openyurt/pkg/yurtctl/cmd/join.newJoinData(0xc0002f4f00, 0xc000154580, 0x1, 0xb, 0xc000246000, 0x19be740, 0xc00000e018, 0x0, 0x0, 0x0)
        /usr/local/gopath/src/github.com/DrmagicE/openyurt-1/pkg/yurtctl/cmd/join/join.go:210 +0x13f
github.com/openyurtio/openyurt/pkg/yurtctl/cmd/join.NewCmdJoin.func2(0xc0002f4f00, 0xc000154580, 0x1, 0xb, 0x0, 0x0, 0x0, 0x0)
        /usr/local/gopath/src/github.com/DrmagicE/openyurt-1/pkg/yurtctl/cmd/join/join.go:110 +0x68
github.com/openyurtio/openyurt/pkg/yurtctl/kubernetes/kubeadm/app/cmd/phases/workflow.(*Runner).InitData(0xc0000c4000, 0xc000154580, 0x1, 0xb, 0xc00063fd10, 0x561d84, 0xc0002f1b80, 0xc0002dc0e0)
        /usr/local/gopath/src/github.com/DrmagicE/openyurt-1/pkg/yurtctl/kubernetes/kubeadm/app/cmd/phases/workflow/runner.go:183 +0x88
github.com/openyurtio/openyurt/pkg/yurtctl/kubernetes/kubeadm/app/cmd/phases/workflow.(*Runner).Run(0xc0000c4000, 0xc000154580, 0x1, 0xb, 0x4, 0x1795b28)
        /usr/local/gopath/src/github.com/DrmagicE/openyurt-1/pkg/yurtctl/kubernetes/kubeadm/app/cmd/phases/workflow/runner.go:203 +0xb0
github.com/openyurtio/openyurt/pkg/yurtctl/cmd/join.NewCmdJoin.func1(0xc0002f4f00, 0xc000154580, 0x1, 0xb, 0x0, 0x0)
        /usr/local/gopath/src/github.com/DrmagicE/openyurt-1/pkg/yurtctl/cmd/join/join.go:95 +0x64
github.com/spf13/cobra.(*Command).execute(0xc0002f4f00, 0xc000154160, 0xb, 0xb, 0xc0002f4f00, 0xc000154160)
        /usr/local/gopath/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:852 +0x453
github.com/spf13/cobra.(*Command).ExecuteC(0xc0002f4000, 0x0, 0x15366c0, 0xc000102058)
        /usr/local/gopath/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:960 +0x349
github.com/spf13/cobra.(*Command).Execute(...)
        /usr/local/gopath/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:897
main.main()
        /usr/local/gopath/src/github.com/DrmagicE/openyurt-1/cmd/yurtctl/yurtctl.go:27 +0x27

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

/assign @rambohe-ch

Does this PR introduce a user-facing change?


other Note

@openyurt-bot
Copy link
Collaborator

@DrmagicE: GitHub didn't allow me to assign the following users: your_reviewer.

Note that only openyurtio members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:
/kind bug
/kind documentation
/kind enhancement
/kind good-first-issue
/kind feature
/kind question
/kind design
/sig ai
/sig iot
/sig network
/sig storage
/sig storage

/kind bug

What this PR does / why we need it:

TheignoreErrors (a map) param is not initialized before using so it will cause panic when useyurtctl join with the flag--ignore-preflight-errors set.

panic: assignment to entry in nil map

goroutine 1 [running]:
k8s.io/apimachinery/pkg/util/sets.String.Insert(0x0, 0xc00063fba0, 0x1, 0x1, 0xc0000a5440)
       /usr/local/gopath/pkg/mod/k8s.io/apimachinery@v0.20.12-rc.0/pkg/util/sets/string.go:51 +0x78
github.com/openyurtio/openyurt/pkg/yurtctl/cmd/join.newJoinData(0xc0002f4f00, 0xc000154580, 0x1, 0xb, 0xc000246000, 0x19be740, 0xc00000e018, 0x0, 0x0, 0x0)
       /usr/local/gopath/src/github.com/DrmagicE/openyurt-1/pkg/yurtctl/cmd/join/join.go:210 +0x13f
github.com/openyurtio/openyurt/pkg/yurtctl/cmd/join.NewCmdJoin.func2(0xc0002f4f00, 0xc000154580, 0x1, 0xb, 0x0, 0x0, 0x0, 0x0)
       /usr/local/gopath/src/github.com/DrmagicE/openyurt-1/pkg/yurtctl/cmd/join/join.go:110 +0x68
github.com/openyurtio/openyurt/pkg/yurtctl/kubernetes/kubeadm/app/cmd/phases/workflow.(*Runner).InitData(0xc0000c4000, 0xc000154580, 0x1, 0xb, 0xc00063fd10, 0x561d84, 0xc0002f1b80, 0xc0002dc0e0)
       /usr/local/gopath/src/github.com/DrmagicE/openyurt-1/pkg/yurtctl/kubernetes/kubeadm/app/cmd/phases/workflow/runner.go:183 +0x88
github.com/openyurtio/openyurt/pkg/yurtctl/kubernetes/kubeadm/app/cmd/phases/workflow.(*Runner).Run(0xc0000c4000, 0xc000154580, 0x1, 0xb, 0x4, 0x1795b28)
       /usr/local/gopath/src/github.com/DrmagicE/openyurt-1/pkg/yurtctl/kubernetes/kubeadm/app/cmd/phases/workflow/runner.go:203 +0xb0
github.com/openyurtio/openyurt/pkg/yurtctl/cmd/join.NewCmdJoin.func1(0xc0002f4f00, 0xc000154580, 0x1, 0xb, 0x0, 0x0)
       /usr/local/gopath/src/github.com/DrmagicE/openyurt-1/pkg/yurtctl/cmd/join/join.go:95 +0x64
github.com/spf13/cobra.(*Command).execute(0xc0002f4f00, 0xc000154160, 0xb, 0xb, 0xc0002f4f00, 0xc000154160)
       /usr/local/gopath/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:852 +0x453
github.com/spf13/cobra.(*Command).ExecuteC(0xc0002f4000, 0x0, 0x15366c0, 0xc000102058)
       /usr/local/gopath/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:960 +0x349
github.com/spf13/cobra.(*Command).Execute(...)
       /usr/local/gopath/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:897
main.main()
       /usr/local/gopath/src/github.com/DrmagicE/openyurt-1/cmd/yurtctl/yurtctl.go:27 +0x27

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

/assign @rambohe-ch

Does this PR introduce a user-facing change?


other Note

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openyurt-bot openyurt-bot added kind/bug kind/bug size/XS size/XS: 0-9 labels Feb 10, 2022
@rambohe-ch
Copy link
Member

/lgtm
/approve

@openyurt-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: DrmagicE, rambohe-ch

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openyurt-bot openyurt-bot added the approved approved label Feb 10, 2022
@rambohe-ch
Copy link
Member

/lgtm

@openyurt-bot openyurt-bot added the lgtm lgtm label Feb 10, 2022
@openyurt-bot openyurt-bot merged commit b76197a into openyurtio:master Feb 10, 2022
rambohe-ch pushed a commit to rambohe-ch/openyurt that referenced this pull request Feb 15, 2022
Co-authored-by: zhanglifang@chinatelecom.cn <zhanglifang@chinatelecom.cn>
openyurt-bot pushed a commit that referenced this pull request Feb 15, 2022
* bugfix: panic happened when x-tunnel-server-svc service type is lb (#724)

* enhancement: tunnel-server supports to proxy requests that access tunnel-server directly with specified destination (#725)

* cache-agent for yurthub support '*' (#727)

* cache-agent for yurthub support '*'

Signed-off-by: 刘畅 <basefly@outlook.com>

* add unit test for cache_agents of yurthub

Signed-off-by: 刘畅 <basefly@outlook.com>

* fmt code

Signed-off-by: 刘畅 <basefly@outlook.com>

* add NoArgs check for cmds (#728)

* fix: not initialized `sets.String` cause panic (#733)

Co-authored-by: zhanglifang@chinatelecom.cn <zhanglifang@chinatelecom.cn>

Co-authored-by: hhstu <55697154+hhstu@users.noreply.github.com>
Co-authored-by: Yifei Zhang <chpzhangyifei@qq.com>
Co-authored-by: DrmagicE <379342542@qq.com>
Co-authored-by: zhanglifang@chinatelecom.cn <zhanglifang@chinatelecom.cn>
MrGirl pushed a commit to MrGirl/openyurt that referenced this pull request Mar 29, 2022
Co-authored-by: zhanglifang@chinatelecom.cn <zhanglifang@chinatelecom.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved approved kind/bug kind/bug lgtm lgtm size/XS size/XS: 0-9
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants