lizhanhui / moquette-mqtt

Automatically exported from code.google.com/p/moquette-mqtt
Apache License 2.0
0 stars 0 forks source link

Resource Leak for ByteBuf #34

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Running 'mvn package', I saw the output below.

What is the expected output? What do you see instead?

...
Running org.dna.mqtt.moquette.server.ServerIntegrationQoSValidationTest
Server stopping...
Server stopped
Server stopping...
Server stopped
Server stopping...
Server stopped
Server stopping...
Server stopped
Server stopping...
Server stopped
Server stopping...
Server stopped
30235 [nioEventLoopGroup-49-1] WARN  ResourceLeakDetector  - LEAK: ByteBuf was 
GC'd before being released correctly.  The following stack trace shows where 
the leaked object was created, rather than where you failed to release it.
io.netty.util.ResourceLeakException: 
io.netty.buffer.UnpooledUnsafeDirectByteBuf@70dc3491
    at io.netty.util.ResourceLeakDetector$DefaultResourceLeak.<init>(ResourceLeakDetector.java:174)
    at io.netty.util.ResourceLeakDetector.open(ResourceLeakDetector.java:116)
    at io.netty.buffer.UnpooledUnsafeDirectByteBuf.<init>(UnpooledUnsafeDirectByteBuf.java:72)
    at io.netty.buffer.UnpooledByteBufAllocator.newDirectBuffer(UnpooledByteBufAllocator.java:49)
    at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:132)
    at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:123)
    at io.netty.buffer.AbstractByteBufAllocator.buffer(AbstractByteBufAllocator.java:60)
    at org.dna.mqtt.moquette.parser.netty.PublishEncoder.encode(PublishEncoder.java:23)
    at org.dna.mqtt.moquette.parser.netty.PublishEncoder.encode(PublishEncoder.java:12)
    at org.dna.mqtt.moquette.parser.netty.MQTTEncoder.encode(MQTTEncoder.java:42)
    at org.dna.mqtt.moquette.parser.netty.MQTTEncoder.encode(MQTTEncoder.java:15)
    at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:111)
    at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:639)
    at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:693)
    at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:632)
    at org.dna.mqtt.moquette.server.netty.metrics.MessageMetricsHandler.write(MessageMetricsHandler.java:39)
    at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:639)
    at io.netty.channel.DefaultChannelHandlerContext.access$2000(DefaultChannelHandlerContext.java:28)
    at io.netty.channel.DefaultChannelHandlerContext$WriteTask.run(DefaultChannelHandlerContext.java:886)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:348)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
    at java.lang.Thread.run(Thread.java:680)
Server stopping...
Server stopped
Server stopping...
Server stopped
Server stopping...
Server stopped
Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 9.049 sec

What version of the product are you using? On what operating system?

Commit: bbb9924c4b8c84fd06f8c41d57e372c4fc8099a6
Mac OS X 10.8.5
java version "1.6.0_51"
Java(TM) SE Runtime Environment (build 1.6.0_51-b11-457-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-457, mixed mode)

Please provide any additional information below.

Original issue reported on code.google.com by yoto...@gmail.com on 18 Feb 2014 at 12:37

GoogleCodeExporter commented 9 years ago
Probably the issue is due to bad deallocation of Netty buffers in encoding 
part. Now seems fixed because also the memory consumption is flat.

Original comment by selva.an...@gmail.com on 23 Feb 2014 at 12:09