discourse/lib/demon
Alan Guo Xiang Tan c1f25cdf5b
FIX: Unicorn master and Sidekiq reopening logs at the same time (#29137)
In our production environment, we have been seeing Sidekiq processes
getting stuck randomly when a USR1 signal is sent to the Unicorn master
process. We have not been able to identify the root cause of why the
Sidekiq process gets stuck. We however noticed that when the Unicorn
master process receives a USR1 signal, it will reopen the logs for the
Unicorn master process first before sending a USR1 signal for the
Unicorn worker processes to reopen the logs. We figured that we should
do the same for the Sidekiq process as well when a USR1 signal.

In this commit, we introduce an arbitrary delay of 1 second before we
the Sidekiq process reopens its log files so as to allow enough time for the Unicorn
master to finish reopening it logs first.

We also do not send reopen logs for the Sidekiq process if the `DISCOURSE_LOG_SIDEKIQ`
env is not present because there is no need to reopen any logs.
2024-10-10 08:01:40 +08:00
..
base.rb FIX: Ensure we dispose of MiniRacer::Context before forking daemons (#28361) 2024-08-14 12:45:34 +08:00
email_sync.rb DEV: Log Unicorn worker timeout backtraces to Rails.logger (#27257) 2024-06-03 12:51:12 +08:00
rails_autospec.rb DEV: Apply syntax_tree formatting to lib/* 2023-01-09 12:10:19 +00:00
sidekiq.rb FIX: Unicorn master and Sidekiq reopening logs at the same time (#29137) 2024-10-10 08:01:40 +08:00