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
Rails 5.0.2/5.0.1 + Puma ActionCable connection issue #28362
Comments
This seems to be an issue in puma. cc @schneems |
@rafaelfranca it could be but I can say this: |
is it the same issue as this websocket-rails/websocket-rails#399 (comment) |
@wonderer007 |
@edwardmp Can you confirm that if you keep the Puma version constant, only upgrading from Rails 5.0.0.1 to 5.0.2 introduces this issue for you? |
@maclover7 I just noticed that different versions of the ActionCable dependency nio4r are used when on 5.0.0.1 or 5.0.1/5.02 (1.2.1 vs 2.0.0). This might also affect this issue. |
@maclover7 |
Dug into this, turns out this is an issue with Puma... Starting with this commit, on this line, Action Cable calls cc puma folks @schneems @nateberkopec @evanphx |
@maclover7 Great that you'd be able to find this out! Sounds logical, but why aren't we seeing any exceptions being raised after a non-existing method is called on Edit:
This indeed sounds like a good thing to implement. I can try to create a PR with different error handling, but what's appropriate here? It probably wouldn't be a good idea to just throw a plain exception when a socket error occurs, but what else can we realistically use, just a log message indicating the error? The latter at least gives users some clue to what might be happening causing an issue like this. |
Yeah, please do see what seems reasonable. I think the problem with keeping an exception is just that we don't have anywhere sane to raise it. Failing that, and assuming we're not "legitimately" eating some other exceptions that we want to be silent, a log message does seem like a reasonable minimum. |
@matthewd
|
@edwardmp Please do! |
Here is a oneliner logging all socket write errors: This needs work though, as I need to call Rails.logger to access the logger, because the logger dependency isn't injected in this class yet. |
Hi @schneems @nateberkopec @evanphx, I've looked into this and tried a few things, simply creating a method similar to the existing write method to primarily just call the socket's write_nonblock method in turn. Unfortunately this did not appear to work/fix the issue, probably there need to be other changes to the existing method code. I think my socket related knowledge is insufficient atm to create a proper fix, so I hope one of you is able to figure this out without spending to much time. Thanks in advance! |
I get this issue too. Rails 5.0.2 (5.1.0.rc1 also), Puma 3.8.2, Ruby 2.4.1p111 |
In the browser I get:
The Rails log loops over these lines when the browser tries to make the connection but can't establish it:
If I change
|
Submitted a PR to start logging socket write errors: #28757 The folks over at Puma (puma/puma#1189) have a temporary fix for the issue on their part (not implementing |
|
Steps to reproduce
Open puma.rb and add SSL certificates:
In my settings I use redis:
Expected behavior
The connection using ActionCable works seamlessly with SSL, just as it does for non-SSL connections.
Actual behavior
If I try to use SSL, this warning message is shown in the client's browser console:
WebSocket connection to 'wss://lvh.me:3000/cable' failed: WebSocket is closed before the connection is established.
System configuration
Ruby version: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
Rails version: Rails 5.0.2 (also confirmed to be not working on 5.0.1, but did work fine in 5.0.0.1)
Borrowed from puma/puma#1189, seeing same issue as user there.
Related issues: #27625, #27421
The text was updated successfully, but these errors were encountered: