{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/33802","repository_url":"https://api.github.com/repos/rails/rails","labels_url":"https://api.github.com/repos/rails/rails/issues/33802/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/33802/comments","events_url":"https://api.github.com/repos/rails/rails/issues/33802/events","html_url":"https://github.com/rails/rails/issues/33802","id":357411320,"node_id":"MDU6SXNzdWUzNTc0MTEzMjA=","number":33802,"title":"ActionCable too many subscriptions ?","user":{"login":"cdalbergue","id":11771656,"node_id":"MDQ6VXNlcjExNzcxNjU2","avatar_url":"https://avatars0.githubusercontent.com/u/11771656?v=4","gravatar_id":"","url":"https://api.github.com/users/cdalbergue","html_url":"https://github.com/cdalbergue","followers_url":"https://api.github.com/users/cdalbergue/followers","following_url":"https://api.github.com/users/cdalbergue/following{/other_user}","gists_url":"https://api.github.com/users/cdalbergue/gists{/gist_id}","starred_url":"https://api.github.com/users/cdalbergue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdalbergue/subscriptions","organizations_url":"https://api.github.com/users/cdalbergue/orgs","repos_url":"https://api.github.com/users/cdalbergue/repos","events_url":"https://api.github.com/users/cdalbergue/events{/privacy}","received_events_url":"https://api.github.com/users/cdalbergue/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-09-05T21:29:07Z","updated_at":"2018-09-11T08:52:17Z","closed_at":null,"author_association":"NONE","body":"### Steps to reproduce\r\nI have an appllication in production with about ~500 users a day and after a period of time, the websockets (powered by actioncable) don't run anymore.\r\n\r\nI checked all the possible logs. The clients received the http upgrade, the backend handles the request properly but here is the problem : I have over 1000 redis pubsub channel opened. I think that it might be the problem but I'm having a hard time troubleshooting it, hope you can help me.\r\n\r\nI need to say that this perfectly works on local environment and on my demo environment (which are exact replicates of my production env except for the physical hardware), so I assume this is a concurrency problem, if you could help me find the bottleneck here...\r\n\r\n### Expected behavior\r\n1 oubsub channel for 1 subscription\r\n\r\n### Actual behavior\r\n1000 opened channel\r\n\r\nI tried to monitor redis pubsub channels and I find some of the channels I defined in my rails app (eg. events-1234)\r\n\r\nBut when I monitor redis activity, I can see a lot of strange pub/sub action going on:\r\n```\r\n...\r\n1536182471.153479 [0 35.187.45.216:41326] \"subscribe\" \"action_cable/Z2lkOi8vZ2Vyb25pbW8vVXNlci85ODk0OTAz\"\r\n1536182471.328922 [0 35.187.45.216:41326] \"subscribe\" \"action_cable/Z2lkOi8vZ2Vyb25pbW8vVXNlci8xMjUyOTE0NzA\"\r\n1536182471.500513 [0 35.187.45.216:41326] \"subscribe\" \"action_cable/Z2lkOi8vZ2Vyb25pbW8vVXNlci8zNTU2MDk4\"\r\n1536182472.014460 [0 35.187.45.216:41328] \"subscribe\" \"action_cable/Z2lkOi8vZ2Vyb25pbW8vVXNlci8zNTYxNjQz\"\r\n...\r\n```\r\n\r\n\r\nWhen I do `redis pubsub' i find all this junk:\r\n```\r\n....\r\n30) \"action_cable/Z2lkOi8vZ2Vyb25pbW8vVXNlci8xNzEyODYzNzc\"\r\n31) \"action_cable/Z2lkOi8vZ2Vyb25pbW8vVXNlci8zNTA4MTgy\"\r\n32) \"action_cable/Z2lkOi8vZ2Vyb25pbW8vVXNlci8xMzExOTA2Njc\"\r\n33) \"action_cable/Z2lkOi8vZ2Vyb25pbW8vVXNlci8xNjU5MDE4Mw\"\r\n34) \"action_cable/Z2lkOi8vZ2Vyb25pbW8vVXNlci8xNDA5NjQ2\"\r\n35) \"action_cable/Z2lkOi8vZ2Vyb25pbW8vVXNlci8xMTgyMzI5\"\r\n36) \"action_cable/Z2lkOi8vZ2Vyb25pbW8vVXNlci8yMzczNTY5\"\r\n37) \"action_cable/Z2lkOi8vZ2Vyb25pbW8vVXNlci8zOTc2NjU2MQ\"\r\n38) \"action_cable/Z2lkOi8vZ2Vyb25pbW8vVXNlci8xOTI1MDQx\"\r\n39) \"action_cable/Z2lkOi8vZ2Vyb25pbW8vVXNlci8yNDUxOTYwMQ\"\r\n40) \"action_cable/Z2lkOi8vZ2Vyb25pbW8vVXNlci8xMTYyODUxMjA\"\r\n41) \"action_cable/Z2lkOi8vZ2Vyb25pbW8vVXNlci8yNDU1MTk0Nw\"\r\n....\r\n```\r\n\r\nI never subscribe to these channels anywhere in my rails app, so I don't understand if that's normal behaviour or if I'm having a problem.\r\n\r\n\r\n### System configuration\r\n**Rails version**: 5.0.1\r\n\r\n**Ruby version**: 2.3.1\r\n\r\n\r\nHope we can fix this together\r\n"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/420198424","html_url":"https://github.com/rails/rails/issues/33802#issuecomment-420198424","issue_url":"https://api.github.com/repos/rails/rails/issues/33802","id":420198424,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMDE5ODQyNA==","user":{"login":"cdalbergue","id":11771656,"node_id":"MDQ6VXNlcjExNzcxNjU2","avatar_url":"https://avatars0.githubusercontent.com/u/11771656?v=4","gravatar_id":"","url":"https://api.github.com/users/cdalbergue","html_url":"https://github.com/cdalbergue","followers_url":"https://api.github.com/users/cdalbergue/followers","following_url":"https://api.github.com/users/cdalbergue/following{/other_user}","gists_url":"https://api.github.com/users/cdalbergue/gists{/gist_id}","starred_url":"https://api.github.com/users/cdalbergue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdalbergue/subscriptions","organizations_url":"https://api.github.com/users/cdalbergue/orgs","repos_url":"https://api.github.com/users/cdalbergue/repos","events_url":"https://api.github.com/users/cdalbergue/events{/privacy}","received_events_url":"https://api.github.com/users/cdalbergue/received_events","type":"User","site_admin":false},"created_at":"2018-09-11T08:52:17Z","updated_at":"2018-09-11T08:52:17Z","author_association":"NONE","body":"Please find here my response codes:\r\n```\r\nStatus Code: 101 Switching Protocols\r\nConnection: upgrade\r\nDate: Tue, 11 Sep 2018 08:49:58 GMT\r\nSec-WebSocket-Accept: XXXXXXX\r\nSec-WebSocket-Protocol: actioncable-v1-json\r\nServer: nginx\r\nUpgrade: websocket\r\n```\r\n\r\nI think it waits about 5 seconds as if the connexion closed unexpectedly"}}
{"actor":{"display_login":"cdalbergue"}}