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 concurrency issue in SumComputeTime #2029

Merged
merged 1 commit into from
Aug 19, 2024

Conversation

zkokelj
Copy link
Contributor

@zkokelj zkokelj commented Aug 19, 2024

Why this change is needed

Last week I gateway crashed with the following error:

fatal error: concurrent map iteration and map write

goroutine 684 [running]:
github.com/ten-protocol/go-ten/tools/walletextension/ratelimiter.(*RateLimiter).SumComputeTime(0xc000440180, {0xb7, 0xe8, 0x4, 0xf1, 0x51, 0x44, 0xee, 0xe7, 0x5, ...})
	/home/obscuro/go-obscuro/tools/walletextension/ratelimiter/rate_limiter.go:108 +0x10f
github.com/ten-protocol/go-ten/tools/walletextension/ratelimiter.(*RateLimiter).Allow(0xc000440180, {0xb7, 0xe8, 0x4, 0xf1, 0x51, 0x44, 0xee, 0xe7, 0x5, ...})
	/home/obscuro/go-obscuro/tools/walletextension/ratelimiter/rate_limiter.go:197 +0x1a8
github.com/ten-protocol/go-ten/tools/walletextension/rpcapi.ExecAuthRPC[...]({0x1762fd0, 0xc0037ee690}, 0xc0005c0000, 0xc000297400, {0x13345f3, 0xe}, {0xc003a5cde0, 0x2, 0x2})
	/home/obscuro/go-obscuro/tools/walletextension/rpcapi/utils.go:107 +0x1a8

I found the issue and fixed it in this PR.

What changes were made as part of this PR

Please provide a high level list of the changes made

PR checks pre-merging

Please indicate below by ticking the checkbox that you have read and performed the required
PR checks

  • PR checks reviewed and performed

@zkokelj zkokelj requested a review from tudor-malene August 19, 2024 10:29
Copy link
Collaborator

@tudor-malene tudor-malene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@zkokelj zkokelj merged commit f453a64 into main Aug 19, 2024
2 checks passed
@zkokelj zkokelj deleted the ziga/fix_rate_limiter_concurrent_write_issue branch August 19, 2024 10:40
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.

2 participants