-
Notifications
You must be signed in to change notification settings - Fork 7k
[core] SetTaskStatus should only be called within the same lock scope where task_entry is retrieved
#52770
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
Merged
Merged
[core] SetTaskStatus should only be called within the same lock scope where task_entry is retrieved
#52770
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -697,15 +697,6 @@ class TaskManager : public TaskFinisherInterface, public TaskResubmissionInterfa | |
| std::vector<ObjectID> *ids_to_release) | ||
| ABSL_LOCKS_EXCLUDED(mu_); | ||
|
|
||
| /// A wrapper of `retry_task_callback_` that sets the task status | ||
| /// and calls `retry_task_callback_`. This function should be the only | ||
| /// caller of `retry_task_callback_`. | ||
| /// | ||
| /// \param[in] task_entry The task entry to retry. | ||
| /// \param[in] object_recovery Whether to retry the task for object recovery. | ||
| /// \param[in] delay_ms The delay in milliseconds before retrying the task. | ||
| void RetryTask(TaskEntry *task_entry, bool object_recovery, uint32_t delay_ms); | ||
|
|
||
| /// Helper function to call RemoveSubmittedTaskReferences on the remaining | ||
| /// dependencies of the given task spec after the task has finished or | ||
| /// failed. The remaining dependencies are plasma objects and any ObjectIDs | ||
|
|
@@ -749,28 +740,35 @@ class TaskManager : public TaskFinisherInterface, public TaskResubmissionInterfa | |
| /// \param attempt_number The attempt number to record the task status change | ||
| /// event. If not specified, the attempt number will be the current attempt number of | ||
| /// the task. | ||
| /// | ||
| /// \note This function updates `task_entry` in place. Please only call | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that this note is not equivalent to For example, the following code satisfies The following example satisfies both. |
||
| /// this function within the same lock scope where `task_entry` is retrieved from | ||
| /// `submissible_tasks_`. If not, the task entry may be invalidated if the flat_hash_map | ||
| /// is rehashed or the element is removed from the map. | ||
| void SetTaskStatus( | ||
| TaskEntry &task_entry, | ||
| rpc::TaskStatus status, | ||
| std::optional<worker::TaskStatusEvent::TaskStateUpdate> state_update = std::nullopt, | ||
| bool include_task_info = false, | ||
| std::optional<int32_t> attempt_number = std::nullopt); | ||
| std::optional<int32_t> attempt_number = std::nullopt) | ||
| ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_); | ||
|
|
||
| /// Update the task entry for the task attempt to reflect retry on resubmit. | ||
| /// | ||
| /// This will set the task status, update the attempt number for the task, and increment | ||
| /// the retry counter. | ||
| /// | ||
| /// \param task_entry Task entry for the corresponding task attempt | ||
| void MarkTaskRetryOnResubmit(TaskEntry &task_entry); | ||
| void MarkTaskRetryOnResubmit(TaskEntry &task_entry) ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_); | ||
|
|
||
| /// Update the task entry for the task attempt to reflect retry on failure. | ||
| /// | ||
| /// This will set the task status, update the attempt number for the task, and increment | ||
| /// the retry counter. | ||
| /// | ||
| /// \param task_entry Task entry for the corresponding task attempt | ||
| void MarkTaskRetryOnFailed(TaskEntry &task_entry, const rpc::RayErrorInfo &error_info); | ||
| void MarkTaskRetryOnFailed(TaskEntry &task_entry, const rpc::RayErrorInfo &error_info) | ||
| ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_); | ||
|
|
||
| /// Mark the stream is ended. | ||
| /// The end of the stream always contains a "sentinel object" passed | ||
|
|
||
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.
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.
this is the only change. Others are for reverting.