* MM-24547: Fix writer leak when connection closes When the connection is closed, the exit path does not shut down the writer goroutine. In which case, it will keep spinning forever. Since we already have the CAS mechanism now, we can move the closing functionality into the main Close method and just call that in the defer block. This makes closing the websocket client idempotent from both perspective - - Explicitly closing. - Closing due to connection tear down. There are still 2 races left: - Using the exported Conn to directly write messages. We cannot do anything about that as long as clients directly using that. - Setting the wsc.pingTimeoutTimer field in a separate goroutine when calling .Connect(). This will need to be seen later. * Fix ineffectual assignment * Duplicate the closing of writer The problem with refactoring the writer closing to a common function was that we needed to wait for the reader to exit before closing the EventChannel and ResponseChannel. But then there is another problem that the API can be used in such a way that the client is liable to call Close without even calling Listen. In that case, we cannot wait for Listen to quit. So from Close, we can only close the connection. And therefore we need to duplicate the writer closing in the read loop's defer block. * Cleanup some comments
Mattermost is an open source, private cloud, Slack-alternative from https://mattermost.com.
It's written in Golang and React and runs as a single Linux binary with MySQL or PostgreSQL. Every month on the 16th a new compiled version is released under an MIT license.
Try out Mattermost
- Join the Mattermost Contributor's server to join community discussions about contributions, development and more
- Join the Mattermost Demo server to try out Mattermost and explore sample use cases
Deploy on Heroku
Note: Heroku preview does not include email or persistent storage
Deploy on a Cloud Platform via Bitnami
Auto-deploy Mattermost to Amazon Web Services, Azure, Google Cloud Platform, or Oracle Cloud Platform via Bitnami.
Install on Your Own Machine
- One-line Docker Preview
- Developer Machine Setup
- Production Install Guides using Linux Binary
- Production Docker Install
Native Mobile and Desktop Apps
In addition to the web interface, you can also download Mattermost clients for Android, iOS, Windows PC, Mac OSX, and Linux.
Get Security Bulletins
Receive notifications of critical security updates. The sophistication of online attackers is perpetually increasing. If you are deploying Mattermost it is highly recommended you subscribe to the Mattermost Security Bulletin mailing list for updates on critical security releases.
Get Involved
- Contribute Code
- Find "Help Wanted" projects
- Join Developer Discussion on a Mattermost Server for contributors
- File Bugs
- Share Feature Ideas
- Get Troubleshooting Help
- Help translate Mattermost
Learn More
- API Options - webhooks, slash commands, drivers and web service
- See who's using Mattermost
- Browse over 700 Mattermost integrations
Get the Latest News
- Twitter - Follow Mattermost
- Blog - Get the latest updates from the Mattermost blog.
- Email - Subscribe to our newsletter (1 or 2 per month)
- Mattermost - Join the ~contributors channel on the Mattermost Community Server.
- IRC - Join the #matterbridge channel on Freenode (thanks to matterircd).
Any other questions, mail us at info@mattermost.com. We’d love to meet you!





