Sidekiq is consuming too much memory, restarting

It suddenly started appearing to me a couple of days ago.

Before I never saw Sidekiq is using too much memory errors in the logs. Now I see them a few times a day.

And today it happened exactly as @pelcami has mentioned: the VM just plainly became unresponsive. SSH didn’t work. No access on HTTP or HTTPS.

The VM is on Azure, so I pulled up the charts, and it showed network activity suddenly dropping down completely to zero (like a cliff) and CPU stuck at around 40% (probably completely using up one core). Restarting the VM solved it.

What I want to say is, it happened so suddenly that it was almost like one minute it was business as usual, normal network traffic, then the next minute it fell off a cliff and dropped to zero. Not gradual at all.

Something is happening to trigger an infinite loop in Sidekiq or something…