hypnotoad's Memory leak

362 views
Skip to first unread message

Ryan Chan

unread,
Jul 4, 2011, 10:13:15 AM7/4/11
to Mojolicious
I don't know if this is the correct place to ask, but anyone
experienced memory leak when using hypnotoad with Mojolicious?

My config:

{
listen => ['http://*:80'],
workers => 8,
user => 'www-data',
group => 'www-data',
pid_file => '/var/run/hypnotoad.pid',
};


The memory grow slowly and take up 500MB of my server memory after
running for 1 month, and only with 8 workers.

Sebastian Riedel

unread,
Jul 4, 2011, 10:41:48 AM7/4/11
to mojol...@googlegroups.com
Small memory leaks wouldn't surprise me, but Hypnotoad restarts every worker after it accepted 1000 connections by default.
So you must be a) very heavy on extremely long lasting keep alive connections or b) very heavy on memory leaks (too heavy for a leak in Hypnotoad itself).

I think your options are a) profile your application and fix memory leaks b) reduce "accepts" setting in your hypnotoad.conf c) use an external process watcher that kills processes that use too much memory (manager will automatically spawn new ones).

http://mojolicio.us/perldoc/Mojo/Server/Hypnotoad#accepts

--
Sebastian Riedel
http://mojolicio.us
http://twitter.com/kraih
http://blog.kraih.com

> --
> You received this message because you are subscribed to the Google Groups "Mojolicious" group.
> To post to this group, send email to mojol...@googlegroups.com (mailto:mojol...@googlegroups.com).
> To unsubscribe from this group, send email to mojolicious...@googlegroups.com (mailto:mojolicious...@googlegroups.com).
> For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.


sri

unread,
Jul 4, 2011, 11:05:36 AM7/4/11
to Mojolicious
Actually "very heavy on long lasting keep alive connections" shouldn't
be able to cause this either, since we have a default limit of 25
requests per keep alive connection, which would be just 25000 requests
per worker and still rather easy to reach.
So my bet is now on a very heavy leak in your application.

--
sebastian

Ryan Chan

unread,
Jul 5, 2011, 10:31:25 AM7/5/11
to Mojolicious
Hello,
In fact, my script is just a simple Hello World example...
Anyway, I will try to observe the memory usage again.

Thanks.

Sebastian Riedel

unread,
Jul 5, 2011, 10:33:31 AM7/5/11
to mojol...@googlegroups.com
That sounds rather strange, an you give me step by step instructions for reproducing the issue?


Am Dienstag, 5. Juli 2011 um 16:31 schrieb Ryan Chan:

> Hello,


>
> On 7月4日, 下午11時05分, sri <kra...@googlemail.com (http://googlemail.com)> wrote:
> > Actually "very heavy on long lasting keep alive connections" shouldn't
> > be able to cause this either, since we have a default limit of 25
> > requests per keep alive connection, which would be just 25000 requests
> > per worker and still rather easy to reach.
> > So my bet is now on a very heavy leak in your application.
>
> In fact, my script is just a simple Hello World example...
> Anyway, I will try to observe the memory usage again.
>
> Thanks.
>

sri

unread,
Jul 5, 2011, 10:35:36 AM7/5/11
to Mojolicious
And i mean real details, like the exact script, configuration,
environment, frequency of incoming requests, traffic spikes...

--
sebastian

Ryan Chan

unread,
Jul 5, 2011, 10:45:49 AM7/5/11
to Mojolicious
Hello,
I will observe again first and get you back if I can reproduce the
error.

Thanks.

sri

unread,
Jul 5, 2011, 12:32:53 PM7/5/11
to Mojolicious
While i've been able to fix one small memory leak in Hypnotoad, i
can't replicate the original issue you're describing.
Even maxing out every single keep alive connection i never managed to
break 900kb before the worker got restarted.

https://github.com/kraih/mojo/commit/3b6b9148cbfe5d9fff52a12ced295bf92ca1be1e

So i'll wait for more in depth information before continuing with my
investigation.

--
sebastian

sri

unread,
Jul 5, 2011, 4:59:02 PM7/5/11
to Mojolicious
Please make sure to use the 1.56 release for future testing.

https://twitter.com/kraih/status/88350120822841344

--
sebastian
Reply all
Reply to author
Forward
0 new messages