Repository navigation
[unsupervised AI] Defer semaphore lease refresh until registration - #9383
Open
GeorgiaPreda wants to merge 1 commit into
Open
GeorgiaPreda wants to merge 1 commit into
GeorgiaPreda wants to merge 1 commit into
Conversation
GeorgiaPreda
marked this pull request as ready for review
October 28, 2026 12:45
Contributor
Unit Test ResultsSee test report for an extended history of previous test failures. This is useful for diagnosing flaky tests. 40 files ± 0 40 suites ±0 14h 0m 32s ⏱️ - 37m 3s For more details on these failures, see this check. Results for commit 58ee127. ± Comparison against base commit dc182bd. |
This branch has not been deployed
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.
RFC to address #8999.
Problem and change
Every deserialized Semaphore started a lease-refresh timer, even when it was only an unused task argument. Task objects can retain these instances, causing active timer counts and idle event-loop CPU to grow with submissions. The bound callback also retained otherwise unreachable semaphore instances.
Start the callback only after successful registration, and use a weak reference inside it. Add regressions covering collection before and after registration, unused arguments not starting timers, and acquisition starting lease renewal.
Verification
Bounded CPU comparison
Separate baseline and changed-code runs used four worker processes, ten unused semaphore arguments per task, 1,200 total submissions, 5 ms simulated tasks, and the default lease timeout. Idle CPU was sampled over approximately 6.5 seconds per checkpoint using thread_time on the shared scheduler/client event-loop thread. Both runs used the same /proc compatibility adjustment.
This supports removal of timer-driven CPU growth in the bounded workload. It is one comparison, not a statistically controlled benchmark, a scheduler-only process measurement, or proof that the original long-running cluster crash is resolved. Task objects still retained semaphore instances during the measurement; unused instances no longer create active timers.
AI tooling: OpenAI GPT-6 via Codex in ChatGPT Work assisted with investigation, implementation, testing and publication.