question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Duplicated IDs are generated

See original GitHub issue

What is the problem?

The string generated by GenerateUniqueBytes is not really unique. https://github.com/ray-project/ray/blob/0178d6318ead643fff6d9ed873c88f71fdac52e7/src/ray/common/id.cc#L40-L53

Ray version and other system information (Python version, TensorFlow version, OS): 1.0.1

Reproduction (REQUIRED)

Apply below patch and run bazel run //:id_test,

diff --git a/src/ray/common/id_test.cc b/src/ray/common/id_test.cc
index 926e6fbd11..f1274d92a5 100644
--- a/src/ray/common/id_test.cc
+++ b/src/ray/common/id_test.cc
@@ -51,6 +51,15 @@ TEST(ActorIDTest, TestActorID) {
     const ActorID actor_id = ActorID::Of(kDefaultJobId, kDefaultDriverTaskId, 1);
     ASSERT_EQ(kDefaultJobId, actor_id.JobId());
   }
+
+  {
+    // test no duplicated ID
+    std::unordered_set<ActorID> ids;
+    for (size_t i = 0; i < 1000000; i++) {
+        auto id = ActorID::Of(kDefaultJobId, kDefaultDriverTaskId, i);
+        RAY_CHECK(ids.insert(id).second) << "Duplicated ID generated: " << id;
+    }
+  }
 }

 TEST(TaskIDTest, TestTaskID) {

You will see the error:

[2020-11-20 05:37:07,442 C 104416 104416] id_test.cc:60:  Check failed: ids.insert(id).second Duplicated ID generated: 584a7e60c7000000

If we cannot run your script, we cannot fix your issue.

  • I have verified my script runs in a clean environment and reproduces the issue.
  • I have verified the issue also occurs with the latest wheels.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:15 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
rkooo567commented, Dec 7, 2020

I see.

There are 2 comments here;

  • When looking at code, it doesn’t look like you need to use an actor pool that recreates actors again and again? Why not just reusing it or use a task (it doesn’t seem to be stateful). Just a suggestion for a workaround.
  • The error is about object ID. The object ID is not created randomly, but we create by incrementing the index for each Ray task (.remote method). This means each single remote task can create 32 bytes number of object ids without conflicts, so I don’t think this actor issue is related. But I’ve definitely seen the related issue; https://github.com/ray-project/ray/issues/9551
1reaction
Dadlecommented, Dec 2, 2020

We have been suffering from this issue for months. it is costly and we are working on external patch to automate restart to avoid this issue. The user experience is that Ray is unstable unfortunately.

We run evolutionary algorithm doing fitness calculations as ray actors. These actors are distributed across 100+ 2CPU EC2 isntance with 200+actors multiple times per second. We run this workload for days at a time. So for us to run 50 000 000+ actors on one cluster for one workload is very common.

Is there a known workaround to not create a new actor ID for each new actor?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enforcing unique study IDs - how to avoid duplicate IDs
In our experience, a random number of 7 digits is sufficiently random, to avoid duplicate IDs.
Read more >
How to generate a unique ID based on duplicate values in ...
I am looking to generate a unique ID based on either e-mail or phonenumber. I expect the script to check through phone numbers...
Read more >
Duplicate person ids when using GenerateNextPersonID
You are using GenerateNextPersonID to generate new Ids and the Ids generated are duplicates when API calls are triggered by multiple users concurrently....
Read more >
PJ39570: DUPLICATE IDS BEING GENERATED FROM ... - IBM
When using the Java API to create a document or custom object, duplicate Ids would be generated occasionally. When an attempt was made...
Read more >
Duplicate IDs: Student Enterprise Systems
An individual has Duplicate EMPL IDs when he/she has two or more EMPL IDs in CAESAR. EMPL IDs created in CAESAR begin with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found