-
Notifications
You must be signed in to change notification settings - Fork 244
Fix possibly failing to reserve slots due to stale issued number #1870
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
Conversation
@@ -346,7 +346,7 @@ func (s slotReserveInfoImpl) WorkerIdentity() string { | |||
} | |||
|
|||
func (s slotReserveInfoImpl) NumIssuedSlots() int { |
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.
Can we document that NumIssuedSlots
is the current number of slots issues and will get updated over time? I can see users getting confused thinking this is the number of reserved slots at the time of the call.
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.
Done 👍
What is the reason for using the |
Also is there a reason this isn't implemented if max slots is provided? https://github.com/temporalio/sdk-go/blob/master/contrib/resourcetuner/resourcetuner.go#L205 |
Because internally we always need to know the issued count, so the tracking supplier does that so it's not duplicated in all implementations. The mutex in the resource based supplier is purely for the last issued time / PID decisions. |
It's debatable. I left it unimplemented because it maps to the "available slots" metric, but, you can easily set a max here that isn't actually attainable in any real sense. |
To confrim we only update our internal count after the slot supplier |
Yup, exactly |
What was changed
Fix a bug where resource based slot supplier was looking at a stale issued slots number while trying to reserve
Why?
Could cause it to be stuck failing to reserve
Checklist
Closes ResourceBasedSlotSupplier.ReleaseSlot not implemented #1868
How was this tested:
Added test
Any docs updates needed?