{"action":"created","issue":{"url":"https://api.github.com/repos/meew0/discordrb/issues/447","repository_url":"https://api.github.com/repos/meew0/discordrb","labels_url":"https://api.github.com/repos/meew0/discordrb/issues/447/labels{/name}","comments_url":"https://api.github.com/repos/meew0/discordrb/issues/447/comments","events_url":"https://api.github.com/repos/meew0/discordrb/issues/447/events","html_url":"https://github.com/meew0/discordrb/issues/447","id":287968128,"node_id":"MDU6SXNzdWUyODc5NjgxMjg=","number":447,"title":"Bot frequently goes offline with zombie connections","user":{"login":"csuhta","id":769083,"node_id":"MDQ6VXNlcjc2OTA4Mw==","avatar_url":"https://avatars2.githubusercontent.com/u/769083?v=4","gravatar_id":"","url":"https://api.github.com/users/csuhta","html_url":"https://github.com/csuhta","followers_url":"https://api.github.com/users/csuhta/followers","following_url":"https://api.github.com/users/csuhta/following{/other_user}","gists_url":"https://api.github.com/users/csuhta/gists{/gist_id}","starred_url":"https://api.github.com/users/csuhta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csuhta/subscriptions","organizations_url":"https://api.github.com/users/csuhta/orgs","repos_url":"https://api.github.com/users/csuhta/repos","events_url":"https://api.github.com/users/csuhta/events{/privacy}","received_events_url":"https://api.github.com/users/csuhta/received_events","type":"User","site_admin":false},"labels":[{"id":346267858,"node_id":"MDU6TGFiZWwzNDYyNjc4NTg=","url":"https://api.github.com/repos/meew0/discordrb/labels/performance","name":"performance","color":"fad8c7","default":false},{"id":249733784,"node_id":"MDU6TGFiZWwyNDk3MzM3ODQ=","url":"https://api.github.com/repos/meew0/discordrb/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2018-01-12T00:10:13Z","updated_at":"2018-10-30T15:26:37Z","closed_at":"2018-01-18T23:30:44Z","author_association":"NONE","body":"Our Discord bot often enters a very slow loop with zombie connections.\r\n\r\nOur bot executes in a Rake task, this is all of the code used:\r\n\r\n```ruby\r\ntask \"discord:run\" => :environment do\r\n\r\n  require \"discordrb\"\r\n\r\n  Thread.abort_on_exception = true\r\n  STDOUT.sync = true\r\n  STDERR.sync = true\r\n\r\n  # Gracefully shut down the server when we get a system signal\r\n  Signal.trap(\"SIGTERM\") { logs \"Shutting down Discord bot\"; exit(0) }\r\n  Signal.trap(\"SIGINT\")  { logs \"Shutting down Discord bot\"; exit(0) }\r\n\r\n  @bot = Discordrb::Commands::CommandBot.new(token: ENV[\"DISCORD_BOT_TOKEN\"], client_id: ENV[\"DISCORD_CLIENT_ID\"], prefix: \"/\")\r\n\r\n  @bot.message do |event|\r\n    # [...] Calls a class that replies to the message event\r\n  end\r\n\r\n  @bot.command(:rule, chain_usable: false, description: \"Rules Lookup\") do |event, rule_number|\r\n    # [...] Calls a class that replies to the command\r\n  end\r\n\r\n  @bot.run :async\r\n\r\nend\r\n```\r\n\r\nHere is a slice of what gets logged to the console, this is even sometimes before the bot receives any events from Discord:\r\n\r\n```\r\n[INFO : websocket @ 2018-01-11 23:48:31.281] Discord using gateway protocol version: 6, requested: 6\r\n[WARN : heartbeat @ 2018-01-11 23:51:15.762] Last heartbeat was not acked, so this is a zombie connection! Reconnecting\r\n[ERROR : heartbeat @ 2018-01-11 23:51:15.763] The websocket connection has closed: nil\r\n[INFO : websocket @ 2018-01-11 23:51:15.763] Instant reconnection flag was set - reconnecting right away\r\n[WARN : heartbeat @ 2018-01-11 23:52:39.268] Last heartbeat was not acked, so this is a zombie connection! Reconnecting\r\n[ERROR : heartbeat @ 2018-01-11 23:53:15.876] The websocket connection has closed: nil\r\n[INFO : websocket @ 2018-01-11 23:53:18.380] Discord using gateway protocol version: 6, requested: 6\r\n[WARN : websocket @ 2018-01-11 23:53:18.380] Server streaming timed out with 245 servers remaining\r\n[WARN : websocket @ 2018-01-11 23:53:18.380] This means some servers are unavailable due to an outage. Notifying ready now, we'll have to live without these servers\r\n[WARN : heartbeat @ 2018-01-11 23:54:40.394] Last heartbeat was not acked, so this is a zombie connection! Reconnecting\r\n[ERROR : heartbeat @ 2018-01-11 23:54:40.398] The websocket connection has closed: nil\r\n[INFO : websocket @ 2018-01-11 23:54:40.399] Instant reconnection flag was set - reconnecting right away\r\n[WARN : heartbeat @ 2018-01-11 23:56:04.086] Last heartbeat was not acked, so this is a zombie connection! Reconnecting\r\n[ERROR : heartbeat @ 2018-01-11 23:56:04.101] The websocket connection has closed: nil\r\n[INFO : websocket @ 2018-01-11 23:56:04.104] Instant reconnection flag was set - reconnecting right away\r\n[INFO : websocket @ 2018-01-11 23:56:13.013] Discord using gateway protocol version: 6, requested: 6\r\n[WARN : heartbeat @ 2018-01-11 23:57:27.606] Last heartbeat was not acked, so this is a zombie connection! Reconnecting\r\n[ERROR : heartbeat @ 2018-01-11 23:57:27.683] The websocket connection has closed: nil\r\n[INFO : websocket @ 2018-01-11 23:57:27.716] Instant reconnection flag was set - reconnecting right away\r\n… (continues for a long time) …\r\n```\r\n\r\nThis happens _at least once a day_, even when the official Discord client is working fine and Discord is not reporting any outages at http://status.discordapp.com\r\n\r\nWhat can we do to debug this situation or make the bot more aggressive about fixing itself? We don't have very much information to work with."},"comment":{"url":"https://api.github.com/repos/meew0/discordrb/issues/comments/434346627","html_url":"https://github.com/meew0/discordrb/issues/447#issuecomment-434346627","issue_url":"https://api.github.com/repos/meew0/discordrb/issues/447","id":434346627,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNDM0NjYyNw==","user":{"login":"mlapeter","id":31036,"node_id":"MDQ6VXNlcjMxMDM2","avatar_url":"https://avatars3.githubusercontent.com/u/31036?v=4","gravatar_id":"","url":"https://api.github.com/users/mlapeter","html_url":"https://github.com/mlapeter","followers_url":"https://api.github.com/users/mlapeter/followers","following_url":"https://api.github.com/users/mlapeter/following{/other_user}","gists_url":"https://api.github.com/users/mlapeter/gists{/gist_id}","starred_url":"https://api.github.com/users/mlapeter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlapeter/subscriptions","organizations_url":"https://api.github.com/users/mlapeter/orgs","repos_url":"https://api.github.com/users/mlapeter/repos","events_url":"https://api.github.com/users/mlapeter/events{/privacy}","received_events_url":"https://api.github.com/users/mlapeter/received_events","type":"User","site_admin":false},"created_at":"2018-10-30T15:26:37Z","updated_at":"2018-10-30T15:26:37Z","author_association":"NONE","body":"@csuhta found this in a google search and running into same issues... curious did you have any luck with sharding or any other solution?"}}
{"actor":{"display_login":"mlapeter"}}