StandardError can make the daemon memory killer busy
Summary
In !16900 (merged), the daemon memory killer start_working
has code logic as:
def start_working
... ...
while enabled?
begin
restart_sidekiq unless rss_within_range?
sleep(CHECK_INTERVAL_SECONDS)
rescue => e
log_exception(e, __method__)
rescue Exception => e # rubocop:disable Lint/RescueException
log_exception(e, __method__ )
raise e
end
end
... ...
end
In the case when restart_sidekiq unless rss_within_range?
throw StandardError, it will log the error and immediately continue do next loop iteration, without sleep(CHECK_INTERVAL_SECONDS)
. If this happens, it may bloat log file too much, and also the deamon thread is busy, until the StandardError gone.
Suggested fix is to always sleep(CHECK_INTERVAL_SECONDS)
in the main loop body. Just re-order it as:
while enabled?
begin
sleep(CHECK_INTERVAL_SECONDS)
restart_sidekiq unless rss_within_range?
rescue => e
... ...