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: In concurrent situations, token similarity leads to multiple loc… #26

Merged
merged 2 commits into from
Jul 31, 2024

Conversation

jefferyjob
Copy link
Owner

@jefferyjob jefferyjob commented Jul 31, 2024

In concurrent situations, token similarity leads to multiple lock acquisitions

The reason for this problem is that my current code implements a "reentrant lock" itself. The token automatically generated by the reentrant lock is based on the nanoseconds of time.Now().UnixNano(). The nanoseconds obtained in multiple concurrencies are consistent, resulting in the passive selection of the reentrant lock for lock counting.

close #24

@jefferyjob jefferyjob added the bug Something isn't working label Jul 31, 2024
@jefferyjob
Copy link
Owner Author

当前生成的 token 是基于 google/uuid 包实现的唯一ID生成。

@jefferyjob jefferyjob merged commit 019332e into main Jul 31, 2024
3 checks passed
@jefferyjob jefferyjob deleted the fix/lock_uuid branch July 31, 2024 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

死锁,或者锁不是原子性
1 participant