Skip to content

fix: InvalidSystemClockException in concurrent#23

Merged
RobThree merged 1 commit intoRobThree:masterfrom
larrynung:fix/invalidSystem-clock-exception-in-concurrent
May 6, 2020
Merged

fix: InvalidSystemClockException in concurrent#23
RobThree merged 1 commit intoRobThree:masterfrom
larrynung:fix/invalidSystem-clock-exception-in-concurrent

Conversation

@larrynung
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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