Memory issues with recycler in 4.1.3.Final

148 views
Skip to first unread message

Julien Viet

unread,
Jul 21, 2016, 6:51:30 PM7/21/16
to ne...@googlegroups.com
Hi,

we are seing OOM "GC overhead limit exceeded" issue in Vert.x test suite on slow machines like Cloudbees or using virtualization on a laptop.

This issue means that the VM spend more time in GC than the rest of the VM (98%), but I’m pretty sure everyone here knows that already.

In the case of Vert.x testsuite, it happens because we create and destroy many Vertx instances and therefore many event loops / threads during the tests.

I spent quite some time on the issue and I found that it happens because the ThreadDeatchWatcher's Recycler DELAYED_RECYCLE fast thread local is a WeakHashMap<Stack, WeakOrderQueue) used by the ThreadPoolCache grows and retains many entries (up to 2000). This WeakHashMap contains recycled objects with large footprint and also the Stack itself reference its Thread that has a large footprint.

I am not saying it is a leak per se, but the maps grows and takes time to be garbaged. This does not prevent the testsuite to run on a laptop but it slows it down and on a slow machines it prevents running the testsuite entirely.

I believe this behavior was introduced by this commit : https://github.com/netty/netty/commit/afafadd3d7caf1e4b346da049baab0afeae0a4bc

The change that makes the whole difference is : https://github.com/netty/netty/commit/afafadd3d7caf1e4b346da049baab0afeae0a4bc#diff-23eafd00fcd66829f8cce343b26c236aR226

The introduction of the field stack in the WeakOrderQueue keeps a reference on the Stack objects, however Stack instances are also weak keys of the fast thread local WeakHashMap and therefore defeats the purpose of the WeakHashMap. Not entirely as it is GC’ed but much less often and increase the memory footprint.

let me know what you think

Julien

Norman Maurer

unread,
Jul 22, 2016, 3:21:25 AM7/22/16
to ne...@googlegroups.com
Yes this sounds not right… So what are the steps to reproduce ? Fire up a vm, checkout vert.x master and run the build ?
> --
> You received this message because you are subscribed to the Google Groups "Netty discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to netty+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/netty/2A547499-D279-4286-AA95-3447EE2B621E%40julienviet.com.
> For more options, visit https://groups.google.com/d/optout.

Julien Viet

unread,
Jul 22, 2016, 5:58:04 AM7/22/16
to ne...@googlegroups.com
Yes with branch netty-4.1.3.Final
> To view this discussion on the web visit https://groups.google.com/d/msgid/netty/D5C167E1-D3C3-4B8F-B4B8-FD4D1793BC1F%40googlemail.com.

Norman Maurer

unread,
Jul 22, 2016, 6:04:26 AM7/22/16
to ne...@googlegroups.com

Julien Viet

unread,
Jul 22, 2016, 6:40:18 AM7/22/16
to ne...@googlegroups.com
Can you deploy a snapshot in sonatype repi with a specific classifier? that would help for testing in cloudbees
> To view this discussion on the web visit https://groups.google.com/d/msgid/netty/BC8153A8-4705-438A-BB3F-A5F099FDEAE8%40googlemail.com.

Norman Maurer

unread,
Jul 22, 2016, 6:50:27 AM7/22/16
to ne...@googlegroups.com

Alexander Lehmann

unread,
Jul 22, 2016, 6:53:13 AM7/22/16
to Netty discussions
I will try to set up a cloudbees build using the netty pr (should work without snapshot version)

Norman Maurer

unread,
Jul 22, 2016, 7:44:28 AM7/22/16
to ne...@googlegroups.com
thanks let me know once you know more….

Julien Viet

unread,
Jul 22, 2016, 8:09:11 AM7/22/16
to ne...@googlegroups.com

julie...@gmail.com

unread,
Jul 22, 2016, 9:53:25 AM7/22/16
to Netty discussions
perhaps you should add a comment saying that no reference to Stack objects should be kept.

Norman Maurer

unread,
Jul 22, 2016, 9:53:59 AM7/22/16
to ne...@googlegroups.com

Julien Viet

unread,
Aug 4, 2016, 9:11:37 AM8/4/16
to ne...@googlegroups.com
I missed it :-)

You received this message because you are subscribed to a topic in the Google Groups "Netty discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/netty/wJ-fzhsSMx8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to netty+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netty/B99EF8AA-91FB-471C-80ED-5FE51643392C%40googlemail.com.
Reply all
Reply to author
Forward
0 new messages