Skip to content
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

fix: InvalidSystemClockException in concurrent #23

Conversation

larrynung
Copy link

fix: InvalidSystemClockException in concurrent

Set timestamp outside lock will cause timestamp lower than _lastgen when concurrent run

@RobThree RobThree merged commit 751bbcd into RobThree:master May 6, 2020
@RobThree
Copy link
Owner

RobThree commented May 6, 2020

Hmm, I don't know what happened here but it was introduced at b582617 ...

Thanks for pointing it out and the PR! 👍

I will publish a new version soon.

@larrynung
Copy link
Author

larrynung commented May 6, 2020

  • Thread A, B invoke CreateIdImpl in concurrent
  • Thread B set timestamp
  • Thread A set timestamp
  • Thread A enter lock block, and update _lastgen
  • Thread B enter lock block after thread A leave lock block
  • Thread B will throw InvalidSystemClockException because timestamp is smaller than _lastgen

RobThree added a commit that referenced this pull request May 6, 2020
@RobThree
Copy link
Owner

RobThree commented May 6, 2020

2.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants