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 panic in cleanupInvalidVolumeMounts #481

Merged
merged 3 commits into from
Aug 16, 2022
Merged

Fix panic in cleanupInvalidVolumeMounts #481

merged 3 commits into from
Aug 16, 2022

Conversation

MissiontoMars
Copy link
Contributor

@MissiontoMars MissiontoMars commented Aug 16, 2022

Why are these changes needed?

Removing elements while iterating over VolumeMounts slice causes panics.

WARN[0000] ingress class annotation is not set for cluster default/raycluster-sample 
--- FAIL: TestCleanupInvalidVolumeMounts (0.00s)
panic: runtime error: index out of range [2] with length 2 [recovered]
        panic: runtime error: index out of range [2] with length 2

goroutine 103 [running]:
testing.tRunner.func1.2({0x10543be80, 0x14000042468})
        /usr/local/go/src/testing/testing.go:1389 +0x1c8
testing.tRunner.func1()
        /usr/local/go/src/testing/testing.go:1392 +0x384
panic({0x10543be80, 0x14000042468})
        /usr/local/go/src/runtime/panic.go:838 +0x204
github.com/ray-project/kuberay/ray-operator/controllers/ray/common.cleanupInvalidVolumeMounts(...)
        /Users/wanxing/work/code/kuberay-github/ray-operator/controllers/ray/common/pod.go:789
github.com/ray-project/kuberay/ray-operator/controllers/ray/common.TestCleanupInvalidVolumeMounts(0x1400020b520?)
        /Users/wanxing/work/code/kuberay-github/ray-operator/controllers/ray/common/pod_test.go:636 +0x500
testing.tRunner(0x1400020b6c0, 0x1054f51c0)
        /usr/local/go/src/testing/testing.go:1439 +0x110
created by testing.(*T).Run
        /usr/local/go/src/testing/testing.go:1486 +0x300
exit status 2

Related issue number

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

@MissiontoMars
Copy link
Contributor Author

@Jeffwan @Basasuya

@Jeffwan
Copy link
Collaborator

Jeffwan commented Aug 16, 2022

Nice catch. I think the slice manipulation is not that elegant in this case. The fix looks good to me.

@Jeffwan Jeffwan merged commit d76c906 into ray-project:master Aug 16, 2022
Jeffwan pushed a commit to Jeffwan/kuberay that referenced this pull request Aug 16, 2022
Jeffwan added a commit that referenced this pull request Aug 17, 2022
* Fix panic in cleanupInvalidVolumeMounts  (#481)

* fix

* assert

* refine

* Properly convert unix time into meta time (#480)

* Add timeout to the query parameters

Signed-off-by: Kevin Su <[email protected]>

* Properly convert unix time into meta time

Signed-off-by: Kevin Su <[email protected]>

Signed-off-by: Kevin Su <[email protected]>

Signed-off-by: Kevin Su <[email protected]>
Co-authored-by: WanXing Wang <[email protected]>
Co-authored-by: Kevin Su <[email protected]>
lowang-bh pushed a commit to lowang-bh/kuberay that referenced this pull request Sep 24, 2023
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.

2 participants