-
Notifications
You must be signed in to change notification settings - Fork 621
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
Race on global variable: factorials #368
Comments
Hi @nasermirzaei89! Thanks for bringing this issue up. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We get a RACE error on running tests in the production with the flag
-race
enabled.And the stack shows it comes from here:
I believe that the reason is multiple goroutines are calling method
ExpTaylor
and this method manipulates the shared variablefactorials
(https://github.com/shopspring/decimal/blob/master/decimal.go#L84).As you used a global variable for caching factorials (#229), it's not goroutine safe and should have a lock.
The text was updated successfully, but these errors were encountered: