Fix: get_stats blocks main thread on storage failure#13550
Closed
UranusSeven wants to merge 2 commits intosgl-project:mainfrom
Closed
Fix: get_stats blocks main thread on storage failure#13550UranusSeven wants to merge 2 commits intosgl-project:mainfrom
get_stats blocks main thread on storage failure#13550UranusSeven wants to merge 2 commits intosgl-project:mainfrom
Conversation
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
ShangmingCai
approved these changes
Nov 19, 2025
Collaborator
ShangmingCai
left a comment
There was a problem hiding this comment.
Looks reasonable to me. cc: @xiezhq-hermann what do you think
5 tasks
Collaborator
|
This issue can be resolved by this PR. Thank you! @UranusSeven |
Collaborator
|
Feel free to reopen this PR if #13407 is not sufficient. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi from novita.ai team 👋
Motivation
When using HiCache with 3fs backend, the main scheduler thread could become blocked when collecting storage metrics via get_stats(). This issue occurs due to lock contention between multiple threads:
Backup thread: Holds the lock during long-running filesystem I/O operations in _batch_set() (decorated with
@synchronized())Main thread: Periodically calls get_stats() (also decorated with
@synchronized()) to collect storage metrics for monitoringWhen storage is slow or down, the backup thread holds the lock for extended periods, causing the main thread to block when trying to acquire the same lock.
Modifications
Changed get_stats() to use non-blocking lock acquisition: uses self.lock.acquire(blocking=False) instead of the
@synchronized()decorator.Accuracy Tests
Benchmarking and Profiling
Checklist