jondot/sneakers

How to handle Memory leak

eldadvcita opened this issue · 3 comments

Hi,
Unfortunately, we maintain several ancient projects which rely heavily on Sneakers.
While profiling those projects, I noticed that their memory footprint increases over time.

In order to not deal with those projects, I need to come up with a workarounde. a common practice (php-fpm, puma using puma_worker_killer, unicorn using unicorn-worker-killer, etc) is to restart the workers based on (1) max number of requests or (2) max memory limit and I wonder if there is an equivalent feature build into Sneakers?

Please advice,
Thanks!

We don't have enough information to suggest something specific. A high number of concurrently processed deliveries can be one contributing factor. You should profile the process, otherwise we can only guess what really consumes the heap, and guessing is very inefficient.

@michaelklishin,
I'm not interested in fixing the situation as the process fail to release ROR/ActiveRecord objects from the heap due to different bugs in old/deprecated libraries. Therefore I'm looking for a simple solution which will simply kill a given worker once it reaches a certain memory limit or handled X amount of messages.

Sneakers doesn't have any provisions for that. This is a monitoring problem and it should be addressed using suitable monitoring tools.