-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix #4499: scheduler panic caused by pod using gpu-number scheduled by volcano with old version (e.g v1.7) #4500
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 #4499: scheduler panic caused by pod using gpu-number scheduled by volcano with old version (e.g v1.7) #4500
Conversation
…no.sh/gpu-number resources Signed-off-by: fanhy36 <[email protected]> Signed-off-by: linuxfhy <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @linuxfhy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request addresses a critical scheduler panic that occurs during an upgrade path from Volcano 1.7 to Volcano 1.12, specifically when pods previously scheduled with volcano.sh/gpu-number resources are involved. The fix prevents the scheduler from crashing by safely handling resource access, ensuring stability during such transitions.
Highlights
- Scheduler Panic Fix: Implemented a fix to prevent a scheduler panic that arises when upgrading from Volcano 1.7 (using volcano.sh/gpu-number resources) to Volcano 1.12 (with Hami device plugin and VGPUEnable).
- Conditional Resource Access: Introduced conditional checks (if gpushare.GpuSharingEnable || gpushare.GpuNumberEnable) in addResource and subResource functions within pkg/scheduler/api/node_info.go.
- Improved Upgrade Stability: Ensures that the scheduler can gracefully handle scenarios where gpushare.DeviceName resources might not be initialized as expected, thereby improving the robustness of the system during version upgrades.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request aims to fix a scheduler panic that occurs during an upgrade. The provided fix is specific to the described scenario but introduces a potential panic in other valid configurations. I've suggested a more robust solution that addresses the underlying issue of unsafe device access for both gpushare and vgpu devices, preventing panics across different configurations. The same logic applies to both addResource and subResource functions.
| if gpushare.GpuSharingEnable || gpushare.GpuNumberEnable { | ||
| ni.Others[gpushare.DeviceName].(Devices).SubResource(pod) | ||
| } | ||
| ni.Others[vgpu.DeviceName].(Devices).SubResource(pod) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to addResource, this fix is incomplete and can lead to a panic. The call to SubResource for vgpu on line 514 is not guarded and will cause a panic if vgpu is disabled and ni.Others[vgpu.DeviceName] is nil.
For robust error handling, this call should be protected by checking the vgpu.VGPUEnable flag, and a safe type assertion should be used to prevent panics from nil device objects.
if gpushare.GpuSharingEnable || gpushare.GpuNumberEnable {
if dev, ok := ni.Others[gpushare.DeviceName].(Devices); ok && dev != nil {
dev.SubResource(pod)
}
}
if vgpu.VGPUEnable {
if dev, ok := ni.Others[vgpu.DeviceName].(Devices); ok && dev != nil {
dev.SubResource(pod)
}
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@linuxfhy Please check it, Gemini is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JesseStutler There is no need, as Volcano v1.7 does not use the vgpu strategy's corresponding resource (volcano.sh/vgpu-number), so there won't be any issues. Moreover, the implementation of the AddResource function under the vgpu strategy already includes a check for an empty gs, providing a double safeguard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to check it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm OK with it, but we'd better add a if judgement; it will be more clear
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Monokaix 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 |
|
Please also cherry-pick to release 1.1 and 1.12 after merged. |
JesseStutler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
…no.sh/gpu-number resources
What type of PR is this?
fix
Which issue(s) this PR fixes:
Fixes #4499
Special notes for your reviewer:
Does this PR introduce a user-facing change?