-
Notifications
You must be signed in to change notification settings - Fork 2k
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
scheduler: fix panic when preempting and evicting allocs #6792
Conversation
Fixes #6787 In ProposedAllocs the proposed alloc slice was being copied while its contents were not. Since RemoveAllocs nils elements of the proposed alloc slice and is called twice, it could panic on the second call when erroneously accessing a nil'd alloc. The fix is to not copy the proposed alloc slice and pass the slice returned by the 1st RemoveAllocs call to the 2nd call, thus maintaining the trimmed length.
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.
👍
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
Code LGTM. This seems like a serious regression. It would be useful to elaborate in the issue (and upgrade guides) explanation the triggering conditions and affected as well as workarounds (e.g. disabling system preemption for folks that don't need it?). |
The bug has existed since 0.9.0-beta1, so it's somewhat rare to hit thankfully. I pushed a docs update to document it. It's a bit of a funky place to mention it, but I can't think of anywhere else more appropriate. Rendered version: |
scheduler: fix panic when preempting and evicting allocs
docs: add #6792 backport to 0.9.7 changelog
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
Sorry about the noisy review. I search/replaced all the noErr helpers to
require.NoError
. Commit6112ad9 contains just the fix.
Fixes #6787
In ProposedAllocs the proposed alloc slice was being copied while its
contents were not. Since RemoveAllocs nils elements of the proposed
alloc slice and is called twice, it could panic on the second call when
erroneously accessing a nil'd alloc.
The fix is to not copy the proposed alloc slice and pass the slice
returned by the 1st RemoveAllocs call to the 2nd call, thus maintaining
the trimmed length.