Algolia rails gem memory leak

After installing the Algolia search rails gem and implementing autoindexing, my servers went down. It seems to be a memory leak. After gutting nothing but that gem and an implementation on a model, I have had zero issues. What is consuming so much memory and how can I avoid this problem?

Hi there,

Which app server are you using? Puma? Unicorn? The gem is not made to be used in a multi-threaded environment so it could be the issue.
Also are you using the latest version of the underlying http client? https://rubygems.org/gems/httpclient/versions/2.8.3

Best,

Actually, it does support multi-threaded web servers; but most of our users are using multi-process web servers -> something might be hidden there?

I am using Puma 3.8.2 and httpclient 2.8.3 is the version on my machines.

That’s weird :confused: Not sure where it could come from. Could you check what Thread.current.keys is returning, just to make sure we’re not polluting the thread-local env?