Skip to content

Instantly share code, notes, and snippets.

@zunda
Created August 21, 2017 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zunda/63c0c2848293b1a6640e306cc2faff35 to your computer and use it in GitHub Desktop.
Save zunda/63c0c2848293b1a6640e306cc2faff35 to your computer and use it in GitHub Desktop.

Mastodonの稼働中にRedisが落ちるとどうなるか、今朝のログを眺めてみました。

まず気づいたのはSidekiqのコネクションプールだった様子:

Aug 20 17:56:49 ERROR: heartbeat: Error connecting to Redis (Redis::TimeoutError) 
  :
Aug 20 17:56:49 ERROR: /app/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/fetch.rb:36:in `block in retrieve_work' 
Aug 20 17:56:49 ERROR: /app/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq.rb:95:in `block in redis' 
Aug 20 17:56:49 ERROR: /app/vendor/bundle/ruby/2.4.0/gems/connection_pool-2.2.1/lib/connection_pool.rb:64:in `block (2 levels) in with' 
  :

Sidekiqからタスクも取れなくなっている:

Aug 20 17:56:51 ERROR: Error fetching job: Error connecting to Redis (Redis::TimeoutError) 

Pumaからもタスクを送れなくなっている:

Aug 20 17:57:00 method=POST path=/api/subscriptions/4190 format=html controller=Api::SubscriptionsController action=update status=500 error='Redis::CannotConnectError: Error connecting to Redis (Redis::TimeoutError)' duration=10017.03 view=0.00 db=1.47 
  :
Aug 20 17:57:00 app/controllers/api/subscriptions_controller.rb:18:in `update' 

そのうちに、rack_timeoutもリクエストキューの処理が遅延しているのに気付き始めました:

Aug 20 17:59:34 method=GET path=/api/v1/notifications format=html controller=Api::V1::NotificationsController action=index status=500 error='Rack::Timeout::RequestTimeoutException: Request waited 0ms, then ran for longer than 30000ms' duration=9980.95 view=0.00 db=8.64 

しばらくすると、エラーがタイムアウトから接続拒否に。

Aug 20 18:07:26 ERROR: heartbeat: Error connecting to Redis (Errno::ECONNREFUSED) 

Redisの復帰時には特にログはありませんでした。今回はdynoの再起動も無かった様子。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment