-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[core] Fix race condition b/w object eviction & repinning for recovery. #53934
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
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c73d3a4
[core] Fix race condition b/w object eviction & repinning for recovery.
israbbani 7ff93f7
formatting
israbbani c559ba0
Merge branch 'master' into irabbani/CORE-1618
israbbani 998db18
Merge branch 'master' into irabbani/CORE-1618
israbbani dbda0e4
Merge branch 'master' into irabbani/CORE-1618
israbbani 9b75f87
[core] Making node manager more testable by
israbbani 330b2ab
Merge branch 'master' into irabbani/CORE-1618
israbbani 4617dc2
format
israbbani fd5c49b
merge conflicts
israbbani 3bdbddf
Fixing clang build
israbbani a190477
A few updates to the unit test:
israbbani 1e84ad2
removing io_service.stop()
israbbani 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
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright 2025 The Ray Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#pragma once | ||
|
||
#include <functional> | ||
#include <memory> | ||
#include <string> | ||
#include <vector> | ||
|
||
#include "ray/common/id.h" | ||
#include "ray/common/ray_object.h" | ||
#include "src/ray/protobuf/node_manager.pb.h" | ||
|
||
namespace ray { | ||
|
||
namespace raylet { | ||
|
||
class LocalObjectManagerInterface { | ||
public: | ||
virtual ~LocalObjectManagerInterface() = default; | ||
|
||
virtual void PinObjectsAndWaitForFree(const std::vector<ObjectID> &, | ||
std::vector<std::unique_ptr<RayObject>> &&, | ||
const rpc::Address &, | ||
const ObjectID & = ObjectID::Nil()) = 0; | ||
|
||
virtual void SpillObjectUptoMaxThroughput() = 0; | ||
|
||
/// TODO(dayshah): This function is only used for testing, we should remove and just | ||
/// keep SpillObjectsInternal. | ||
virtual void SpillObjects(const std::vector<ObjectID> &, | ||
std::function<void(const ray::Status &)>) = 0; | ||
|
||
virtual void AsyncRestoreSpilledObject(const ObjectID &, | ||
int64_t, | ||
const std::string &, | ||
std::function<void(const ray::Status &)>) = 0; | ||
|
||
virtual void FlushFreeObjects() = 0; | ||
|
||
virtual bool ObjectPendingDeletion(const ObjectID &) = 0; | ||
|
||
virtual void ProcessSpilledObjectsDeleteQueue(uint32_t) = 0; | ||
|
||
virtual bool IsSpillingInProgress() = 0; | ||
|
||
virtual void FillObjectStoreStats(rpc::GetNodeStatsReply *) const = 0; | ||
|
||
virtual void RecordMetrics() const = 0; | ||
|
||
virtual std::string GetLocalSpilledObjectURL(const ObjectID &) = 0; | ||
|
||
virtual int64_t GetPrimaryBytes() const = 0; | ||
|
||
virtual bool HasLocallySpilledObjects() const = 0; | ||
|
||
virtual std::string DebugString() const = 0; | ||
}; | ||
|
||
}; // namespace raylet | ||
|
||
}; // namespace ray | ||
dayshah marked this conversation as resolved.
Show resolved
Hide resolved
|
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 |
---|---|---|
|
@@ -42,6 +42,7 @@ | |
#include "ray/gcs/pb_util.h" | ||
#include "ray/object_manager/ownership_object_directory.h" | ||
#include "ray/raylet/format/node_manager_generated.h" | ||
#include "ray/raylet/local_object_manager_interface.h" | ||
#include "ray/raylet/scheduling/cluster_task_manager.h" | ||
#include "ray/raylet/worker_killing_policy.h" | ||
#include "ray/raylet/worker_pool.h" | ||
|
@@ -121,7 +122,7 @@ NodeManager::NodeManager( | |
ClusterTaskManagerInterface &cluster_task_manager, | ||
IObjectDirectory &object_directory, | ||
ObjectManagerInterface &object_manager, | ||
LocalObjectManager &local_object_manager, | ||
LocalObjectManagerInterface &local_object_manager, | ||
DependencyManager &dependency_manager, | ||
WorkerPoolInterface &worker_pool, | ||
absl::flat_hash_map<WorkerID, std::shared_ptr<WorkerInterface>> &leased_workers, | ||
|
@@ -2490,11 +2491,16 @@ void NodeManager::HandlePinObjectIDs(rpc::PinObjectIDsRequest request, | |
auto object_id_it = object_ids.begin(); | ||
auto result_it = results.begin(); | ||
while (object_id_it != object_ids.end()) { | ||
if (*result_it == nullptr) { | ||
// Note: It is safe to call ObjectPendingDeletion here because the asynchronous | ||
// deletion can only happen on the same thread as the call to HandlePinObjectIDs. | ||
// Therefore, a new object cannot be marked for deletion while this function is | ||
// executing. | ||
if (*result_it == nullptr || | ||
local_object_manager_.ObjectPendingDeletion(*object_id_it)) { | ||
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. This is the fix and logic change. |
||
RAY_LOG(DEBUG).WithField(*object_id_it) | ||
<< "Failed to get object in the object store. This should only happen when " | ||
"the owner tries to pin a " | ||
<< "secondary copy and it's evicted in the meantime"; | ||
"the owner tries to pin an object and it's already been deleted or is " | ||
"marked for deletion."; | ||
object_id_it = object_ids.erase(object_id_it); | ||
result_it = results.erase(result_it); | ||
reply->add_successes(false); | ||
|
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
probably no jira tickets in oss code, make it a gh issue or don't keep in code