Hello,
I am sure I must be doing something wrong here...but it isn't obvious.
I have my own websockets implementation using netty...initially designed using Netty 3
but recently moved to Netty 4 (currently 4.0.15). I am testing with jdk 7 51 (x64) on Cent OS 6.3. My own Netty
implementation uses the Netty native http functionality, just like the netty native implementation. I am not sure
if this is relevant but this is running under OSGi in Karaf 2.3.3.
When executing long running session load tests against my server (several thousand clients hammering the system),
everything is working fine. Memory appears to stabilize quite nicely. I can run these tests for hours/overnight with tens
of millions of requests.
However, If I test very short sessions (open a websocket connection, send/receive a couple of
messages and close the websocket session) I appear to be leaking a massive amount of native memory
(guesstimate of 50-100K bytes per connection). I believe it to be native memory as I can't see anything
wrong in Java profilers (or when looking at the heap/native memory JMX beans),yet the memory keeps increasing
eventually causing the OS to kill the process.
To try to completely rule out Netty native memory allocation in this I have tried to stop Netty from using any
native memory via Unsafe. I setup:
- childOption(channelOption.ALLOCATOR, new UnpooledByteBufAllocator(false));
- Set the options "-Dio.netty.noUnsafe=true" and "-Dio.netty.noPreferDirect=true"
and verified these options are on from the netty logs.
Even with these options on I still appear to be leaking the same amount of native memory.
I have tried the "paranoid" leak detector option as well...but I don't see any errors.
I am a little bit baffled.
So my questions are:
(1) Any foolish things I could be doing wrong which could cause such a big native memory leak like this
with Netty?
(1) Are there any other options I need to turn on/off to make sure that Netty does not use Native memory?
(2) This is slightly off-topic, but does anyone know of any good tooling for looking into java native memory leaks?
I tried using valgrind, but that was painfully, painfully slow (x100000 times slower)...making it difficult to run
enough tests to make any memory leak stick out from all the other valgrind noise.
Any pointers/suggestions would be greatly appreciated.
thanks in advance,
Gareth