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: Prevent concurrent map writes in retries endpoint #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bflad
Copy link
Member

@bflad bflad commented Jan 28, 2025

Noticed a few times running generator testing locally the Docker container would crash. From the logs:

2025-01-28 20:42:47 fatal error: fatal error: concurrent map writes
2025-01-28 20:42:47 concurrent map writes
2025-01-28 20:42:47
2025-01-28 20:42:47 goroutine 2978 [running]:
2025-01-28 20:42:47 github.com/speakeasy-api/speakeasy-api-test-service/internal/retries.HandleRetries({0x9a13a0, 0xc0000ffa40}, 0xc000473a40)
2025-01-28 20:42:47     /app/internal/retries/service.go:52 +0x16b

This change wraps map writes with a mutex.

Noticed a few times running generator testing locally the Docker container would crash. From the logs:

```
2025-01-28 20:42:47 fatal error: fatal error: concurrent map writes
2025-01-28 20:42:47 concurrent map writes
2025-01-28 20:42:47
2025-01-28 20:42:47 goroutine 2978 [running]:
2025-01-28 20:42:47 github.com/speakeasy-api/speakeasy-api-test-service/internal/retries.HandleRetries({0x9a13a0, 0xc0000ffa40}, 0xc000473a40)
2025-01-28 20:42:47     /app/internal/retries/service.go:52 +0x16b
```

This change wraps map writes with a mutex.
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.

1 participant