Puma 6 deadlock, when a code-reload occurs, while an actioncable connection is open
gamecreature opened this issue · comments
A deadlock happens on a code reload when the page has open ActionCable/Websockets connection.
This only occures in development mode with Puma 6.
More details can be found this sample project I created:
https://github.com/gamecreature/puma6-dev-deadlock
Puma config:
Default puma config file from the rails distribution.
To Reproduce
- startup the server
rails server
- Open the app in a browser on a page with an open actioncable stream http://localhost:3000/
- Refresh the page (Cmd+R)
- No problems yet.
- Do a code change in for example
app/views/messages/index.html.erb
and save the file - Refresh the page (Cmd+R)
- The app hangs, usually the first time.
Expected behavior
I don't expect a deadlock to occure
Desktop (please complete the following information):
- OS: [Mac]
- Puma Version [6.0]
- Using latest Safari to trigger the refresh
Extra things I noticed
- This happens in several application that use an actioncable connection I have tested with Puma 6
- The code runs fine with Puma 5
- removing an active ActionCable/Websocket connection from the page will stop this bug. (I assume the deadlock occures in the combination with ActionCable/Websockets). In this code example removing the turbo_stream_from "messages" line, solves it.
- The problem doesn't happen in production mode
- The problem happens when a code-reload takes place
- I also suspect this problem occures when switching hostnames within the same application (I noticed this problem in a pretty complex multi-tentant App, which hangs when going to another hostname, even without code change)
Well it seems that this is issue has been resolved yesterday: 3d33475. (Using the code from this commit solves it)
You guys are really fast! 🙏🏻😂
Closing as duplicate of #2999