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 kubeturbo panic when it is stopped on command line #137

Merged
merged 2 commits into from
Jun 30, 2022

Conversation

ading1977
Copy link
Collaborator

Problem

kubeturbo panic when stopped on command line:

I0624 11:57:56.293012   77936 tap_service.go:111] Begin to stop TAP service.
I0624 11:57:56.293022   77936 mediation_container.go:86] [CloseMediationContainer] Closing mediation container .....
I0624 11:57:56.293031   77936 tap_service.go:113] TAP service is stopped.
I0624 11:57:56.293041   77936 kubeturbo_builder.go:447] Kubeturbo service is stopped.
panic: send on closed channel
goroutine 346 [running]:
github.com/turbonomic/turbo-go-sdk/pkg/service.(*TAPService).getJwtToken(0xc000a937a0, 0xc000584f78, 0xc000584f68)
        /Users/mengding/go/src/github.com/turbonomic/kubeturbo/vendor/github.com/turbonomic/turbo-go-sdk/pkg/service/tap_service.go:60 +0x56
created by github.com/turbonomic/turbo-go-sdk/pkg/service.(*TAPService).ConnectToTurbo
        /Users/mengding/go/src/github.com/turbonomic/kubeturbo/vendor/github.com/turbonomic/turbo-go-sdk/pkg/service/tap_service.go:106 +0x265
Process finished with the exit code 2

Cause

This is caused by a race condition, where kubeturbo may write to a closed channel (i.e., jwTokenChannel) during clean up.

Solution

  • Break out of the loop of getJwtToken when detecting the close of refreshTokenChannel channel. This way, there is no chance for kubeturbo to write to jwTokenChannel when refreshTokenChannel is closed.

@coveralls
Copy link

coveralls commented Jun 29, 2022

Coverage Status

Coverage decreased (-0.03%) to 48.258% when pulling 2d6a43a on ading1977:bugfix/OM-86907 into 5e8ddac on turbonomic:master.

@ading1977 ading1977 merged commit af77c3e into turbonomic:master Jun 30, 2022
@ading1977 ading1977 deleted the bugfix/OM-86907 branch May 12, 2023 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants