paralleldrive / cuid

Collision-resistant ids optimized for horizontal scaling and performance.
Other
3.44k stars 123 forks source link

Need help regarding collision of ids #102

Closed dnmahendra closed 6 years ago

dnmahendra commented 6 years ago

screen shot 2018-04-10 at 2 22 00 pm

I am using this package to generate impression_ids for the products listed on the website pages. These impressions are getting stored in the database. The above screenshot shows for the same device_id at different times on different pages there is collision of ids happening.

Can I get any advise regarding this?

ericelliott commented 6 years ago

Sometimes people see things like this as the result of bugs in the software, rather than duplicate ids being generated. For example, a record may be generated, and an ID is stored in some shared mutable state.

The timestamp in the id is identical to the millisecond, suggesting that the two ids were generated in the same millisecond. Also, the host fingerprints are identical, and the instance counter is identical.

The only way that's possible is if they were generated during the same millisecond on the same host, and both the first id issued by the software instance running cuid.

Things to check:

Do some digging, if you can supply some code that reproduces the problem and show that it's a problem with cuid, please reopen this issue.

If you reopen, please also include: