Skip to content

Add mutex to prevent concurrent writes to websocket connection #1642

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

Merged
merged 4 commits into from
Apr 14, 2025

Conversation

Ale-Cas
Copy link
Contributor

@Ale-Cas Ale-Cas commented Apr 11, 2025

Pull Request Template

Description:
Resolves: #1573

Additional Information:

The panic: concurrent write to websocket connection is avoided through the use of a mutex to protect gorilla/websocket WriteMessage from race conditions.

Moved core implementation from #1601 (comment)

Checklist:

  • I have formatted my code using goimport and golangci-lint.
  • All new code is covered by unit tests.
  • This PR does not decrease the overall code coverage.
  • I have reviewed the code comments and documentation for clarity.

@aryanmehrotra aryanmehrotra merged commit d0aea94 into gofr-dev:development Apr 14, 2025
15 checks passed
@Ale-Cas Ale-Cas deleted the add-ws-write-mutex branch April 14, 2025 16:14
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.

Error while concurrently writing to WebSocket using WriteMessageToSocket
4 participants