WebFaction
Community site: login faq

I have a Rails app that works perfectly in development. I have deployed to the server and the app loads and correctly shows its landing and about pages. However, when I got to a page where Action Cable is set up, the server blocks. The last request out from the web page is Action Cable related, and further page actions (form submission, and even reloads) and not responded to.

I have isolated it to the server as loading the main page from another browser shows it is not responsive. Closing the tab where the request to Action Cable was first made results in the other page loading immediately (and all of the pending requests from the first page suddenly being processed).

I do not see any errors in production.log, but here is the part leading up to the hang:

I, [2018-01-24T21:12:38.601260 #9840]  INFO -- : [86b3fcc1-cebd-4d70-99ff-b6f9f147bc00]   Rendered collection of skill_checks/_skill_check.html.erb [5 times] (16.7ms)
I, [2018-01-24T21:12:38.601352 #9840]  INFO -- : [86b3fcc1-cebd-4d70-99ff-b6f9f147bc00]   Rendered rooms/show.html.erb within layouts/application (26.6ms)
I, [2018-01-24T21:12:38.602314 #9840]  INFO -- : [86b3fcc1-cebd-4d70-99ff-b6f9f147bc00] Completed 200 OK in 32ms (Views: 26.7ms | ActiveRecord: 1.8ms)
I, [2018-01-24T21:12:38.740061 #9840]  INFO -- : [5a06a7d8-a4a5-4ab4-8287-377dfa3447fe] Started GET "/cable" for 65.99.102.74 at 2018-01-24 21:12:38 +0000
I, [2018-01-24T21:12:38.740860 #9840]  INFO -- : [5a06a7d8-a4a5-4ab4-8287-377dfa3447fe] Started GET "/cable/" [WebSocket] for 65.99.102.74 at 2018-01-24 21:12:38 +0000
I, [2018-01-24T21:12:38.740970 #9840]  INFO -- : [5a06a7d8-a4a5-4ab4-8287-377dfa3447fe] Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: upgrade, HTTP_UPGRADE: websocket)
I, [2018-01-24T21:12:38.794498 #9840]  INFO -- : RoomsChannel is transmitting the subscription confirmation
I, [2018-01-24T21:12:38.795245 #9840]  INFO -- : RoomsChannel is streaming from room_helloworld

Once I close the offending tab, load continues (of a javascript request that triggers on page reload) as follows:

I, [2018-01-24T21:15:55.109087 #9840]  INFO -- : Finished "/cable/" [WebSocket] for 65.99.102.74 at 2018-01-24 21:15:55 +0000
I, [2018-01-24T21:15:55.109342 #9840]  INFO -- : RoomsChannel stopped streaming from room_helloworld
I, [2018-01-24T21:15:55.110922 #9840]  INFO -- : [2cf5cc53-2f44-42a9-be30-496bb80646a0] Started GET "/rooms/helloworld?update=true" for 65.99.102.74 at 2018-01-24 21:15:55 +0000
I, [2018-01-24T21:15:55.112841 #9840]  INFO -- : [2cf5cc53-2f44-42a9-be30-496bb80646a0] Processing by RoomsController#show as HTML

I've truncated the remainder; there were no failures or anything else of interest in there.

I do have a redis server running on the same server and have put its port information into config/cable.yml under the production: section.

Update: I have since connected to redis through redis-cli and subscribed to a channel, and then through the Rails console sent a broadcast message to that channel and verified receipt - so I know that Rails can at least see redis.

asked 24 Jan, 21:17

El Tea
134
accept rate: 100%

edited 24 Jan, 21:31


I'm certain someone else will have this issue, so to share my answer:

This turned out the be the behaviour you get if you haven't set the following lines inside of your nginx conf file (inside of the server section):

location /cable { passenger_app_group_name your_app_websocket; passenger_force_max_concurrent_requests_per_process 0; }

where, if your app name is "chat", the first line would read:

passenger_app_group_name chat_action_cable

Though I'm not sure where chat_action_cable is defined. May be Rails defaults?

permanent link

answered 25 Jan, 02:35

El Tea
134
accept rate: 100%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×107
×1

question asked: 24 Jan, 21:17

question was seen: 571 times

last updated: 25 Jan, 02:35

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2016 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM