Skip to content

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants