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: Fix for eviction deadlock #25

Merged
merged 1 commit into from
Mar 19, 2022
Merged

fix: Fix for eviction deadlock #25

merged 1 commit into from
Mar 19, 2022

Conversation

njhill
Copy link
Member

@njhill njhill commented Mar 19, 2022

Motivation

A recent fix for a cascading eviction race condition introduced the possibility of a deadlock between the model cache lock and per-cache entry locks due to eviction callback logic now performed in-line under the cache lock.

Modifications

Rework cache accounting logic to make an eviction/unload related adjustment unconditionally up-front within the cache lock so that it can be released before the entry removal/unload processing is performed along with state-dependent readjustment if necessary.

Also:

  • Ensure all entry weight updates are guarded by the cache lock
  • Change the cache's oldestTime() method to not take the cache lock since it's used on the inference request path

Result

Hopefully no more deadlocks

Signed-off-by: Nick Hill [email protected]

@kserve-oss-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: njhill

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Motivation

A recent fix for a cascading eviction race condition introduced the possibility of a deadlock between the model cache lock and per-cache entry locks due to eviction callback logic now performed in-line under the cache lock.

Modifications

Rework cache accounting logic to make an eviction/unload related adjustment unconditionally up-front within the cache lock so that it can be released before the entry removal/unload processing is performed along with state-dependent readjustment if necessary.

Also:
- Ensure all entry weight updates are guarded by the cache lock
- Change the cache's oldestTime() method to not take the cache lock since it's used on the inference request path

Result

Hopefully no more deadlocks

Signed-off-by: Nick Hill <[email protected]>
@njhill njhill force-pushed the deadlock-fix branch 2 times, most recently from 696c2a2 to 7fedcb4 Compare March 19, 2022 02:39
@njhill njhill changed the title testonly: Deadlock fix fix: Fix for eviction deadlock Mar 19, 2022
@njhill njhill marked this pull request as ready for review March 19, 2022 02:59
@njhill
Copy link
Member Author

njhill commented Mar 19, 2022

This has passed our internal deployment tests, Merging due to urgency of fix and will be performing reviews in parallel.

@njhill njhill merged commit 9a0f796 into main Mar 19, 2022
@njhill njhill deleted the deadlock-fix branch March 19, 2022 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants