[tool] fix: make rate-limiter actor detached to prevent ActorDiedError#5327
Open
mirrorboat wants to merge 2 commits intoverl-project:mainfrom
Open
[tool] fix: make rate-limiter actor detached to prevent ActorDiedError#5327mirrorboat wants to merge 2 commits intoverl-project:mainfrom
mirrorboat wants to merge 2 commits intoverl-project:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request correctly identifies and addresses a critical stability issue where the rate-limiter actor was being terminated prematurely due to its ownership by a non-detached worker. By transitioning the TokenBucketWorker to a detached actor, its lifecycle is now independent of the creating worker, which effectively prevents the ActorDiedError. My feedback focuses on improving the robustness of this fix by avoiding potential name collisions in the global Ray actor registry and simplifying the initialization logic using Ray's built-in 'get or create' functionality.
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.
What does this PR do?
This PR addresses a critical stability issue in the
SearchToolwhere concurrent executions would intermittently fail withray.exceptions.ActorDiedError. The root cause was that theTokenBucketWorker(named "rate-limiter") was created as a regular Ray actor, tying its lifecycle to the creatingSearchExecutionWorkerinstance. When theSearchExecutionWorkerwas garbage-collected or released, Ray would automatically terminate the rate-limiter actor, causing subsequent search executions to fail.To resolve this, the
TokenBucketWorkeris now explicitly created as a detached actor usinglifetime="detached". This ensures the rate limiter persists independently of any individual tool instance and remains available for the entire duration of the Ray cluster session. The initialization logic has been updated to safely reuse an existing detached actor if it already exists, enabling shared global rate limiting across multipleSearchToolinstances.Error log:
Ray log of TokenBucketWorker(pid: 194826)
Ray log of the owner of TokenBucketWorker(pid: 194826), i.e., Id: 0c9085d20c7700587d14ba3be8178e9f62fcf32ff0001eb872e76430