Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby production server memory leak

I have a production rails application server, the memory usage of rails worker process of which increases from ~300 MB to ~1.2GB in 3-4 days.

How can I debug this memory leak. I am using rvm 2.2.2 and my application server is deployed in AWS:ElasticBeanstalk . I am using puma web server.

Please provide detailed answer.

like image 303
anshul410 Avatar asked Mar 04 '26 16:03

anshul410


1 Answers

I've faced a similar problem recently with ruby 2.2.2. I was writing to AWS S3 with the aws-sdk gem. I found the solution on this issue on aws-sdk GitHub.

There is a memory leak in the StringIO class shipped with ruby 2.2.0 to 2.2.2. This class is used by aws-sdk when sending files to S3. This bug was reported and fixed on 2.2.3.

Hopefully, upgrading to ruby 2.2.3 will fix your problem.

like image 134
haradwaith Avatar answered Mar 07 '26 04:03

haradwaith