mrniko / netty-socketio

Socket.IO server implemented on Java. Realtime java framework
Apache License 2.0
6.82k stars 1.65k forks source link

[BUG] Memory LEAK v1.7.4 #185

Closed dgolovin-dev closed 9 years ago

dgolovin-dev commented 9 years ago

20:52:05 ERROR ResourceLeakDetector: LEAK: ByteBuf.release() was not called before it's garbage-collected. Recent access records: 1

1:

io.netty.buffer.AdvancedLeakAwareByteBuf.writeBytes(AdvancedLeakAwareByteBuf.java:571)
io.netty.buffer.ByteBufOutputStream.write(ByteBufOutputStream.java:66)
com.fasterxml.jackson.core.json.UTF8JsonGenerator._flushBuffer(UTF8JsonGenerator.java:1853)
com.fasterxml.jackson.core.json.UTF8JsonGenerator.close(UTF8JsonGenerator.java:1065)
com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:2868)
com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:2289)
com.corundumstudio.socketio.protocol.JacksonJsonSupport.writeValue(JacksonJsonSupport.java:385)
com.corundumstudio.socketio.JsonSupportWrapper.writeValue(JsonSupportWrapper.java:70)
com.corundumstudio.socketio.protocol.PacketEncoder.encodePacket(PacketEncoder.java:270)
com.corundumstudio.socketio.handler.EncoderHandler.handleWebsocket(EncoderHandler.java:215)
com.corundumstudio.socketio.handler.EncoderHandler.write(EncoderHandler.java:194)
io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658)
io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716)
io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:706)
io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:741)
io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:895)
io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:243)
com.corundumstudio.socketio.handler.ClientHead.sendPackets(ClientHead.java:151)
com.corundumstudio.socketio.handler.ClientHead.send(ClientHead.java:146)
com.corundumstudio.socketio.handler.ClientHead.send(ClientHead.java:114)
com.corundumstudio.socketio.transport.NamespaceClient.send(NamespaceClient.java:108)
com.corundumstudio.socketio.transport.NamespaceClient.sendEvent(NamespaceClient.java:75)
com.andiks.webserver.client.AbstractClientEndPoint.cookieAuth(AbstractClientEndPoint.java:247)
com.andiks.webserver.client.AbstractClientEndPoint.lambda$attachConnectListener$0(AbstractClientEndPoint.java:121)
com.andiks.webserver.client.AbstractClientEndPoint$$Lambda$16/203409950.onConnect(Unknown Source)
com.corundumstudio.socketio.namespace.Namespace.onConnect(Namespace.java:196)
com.corundumstudio.socketio.handler.PacketListener.onPacket(PacketListener.java:87)
com.corundumstudio.socketio.handler.InPacketHandler.channelRead0(InPacketHandler.java:84)
com.corundumstudio.socketio.handler.InPacketHandler.channelRead0(InPacketHandler.java:36)
io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:166)
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787)
com.corundumstudio.socketio.transport.WebSocketTransport.channelRead(WebSocketTransport.java:92)
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
com.corundumstudio.socketio.transport.PollingTransport.channelRead(PollingTransport.java:109)
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
com.corundumstudio.socketio.handler.AuthorizeHandler.channelRead(AuthorizeHandler.java:115)
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:108)
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:161)
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787)
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:130)
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
java.lang.Thread.run(Thread.java:745)

Created at: io.netty.buffer.UnpooledByteBufAllocator.newDirectBuffer(UnpooledByteBufAllocator.java:55) io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:155) io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:146) io.netty.buffer.AbstractByteBufAllocator.ioBuffer(AbstractByteBufAllocator.java:99) com.corundumstudio.socketio.protocol.PacketEncoder.allocateBuffer(PacketEncoder.java:52) com.corundumstudio.socketio.protocol.PacketEncoder.encodePacket(PacketEncoder.java:262) com.corundumstudio.socketio.handler.EncoderHandler.handleWebsocket(EncoderHandler.java:215) com.corundumstudio.socketio.handler.EncoderHandler.write(EncoderHandler.java:194) io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716) io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:706) io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:741) io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:895) io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:243) com.corundumstudio.socketio.handler.ClientHead.sendPackets(ClientHead.java:151) com.corundumstudio.socketio.handler.ClientHead.send(ClientHead.java:146) com.corundumstudio.socketio.handler.ClientHead.send(ClientHead.java:114) com.corundumstudio.socketio.transport.NamespaceClient.send(NamespaceClient.java:108) com.corundumstudio.socketio.transport.NamespaceClient.sendEvent(NamespaceClient.java:75) com.andiks.webserver.client.AbstractClientEndPoint.cookieAuth(AbstractClientEndPoint.java:247) com.andiks.webserver.client.AbstractClientEndPoint.lambda$attachConnectListener$0(AbstractClientEndPoint.java:121) com.andiks.webserver.client.AbstractClientEndPoint$$Lambda$16/203409950.onConnect(Unknown Source) com.corundumstudio.socketio.namespace.Namespace.onConnect(Namespace.java:196) com.corundumstudio.socketio.handler.PacketListener.onPacket(PacketListener.java:87) com.corundumstudio.socketio.handler.InPacketHandler.channelRead0(InPacketHandler.java:84) com.corundumstudio.socketio.handler.InPacketHandler.channelRead0(InPacketHandler.java:36) io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:166) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) com.corundumstudio.socketio.transport.WebSocketTransport.channelRead(WebSocketTransport.java:92) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) com.corundumstudio.socketio.transport.PollingTransport.channelRead(PollingTransport.java:109) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) com.corundumstudio.socketio.handler.AuthorizeHandler.channelRead(AuthorizeHandler.java:115) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:108) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:161) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:130) io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) java.lang.Thread.run(Thread.java:745)

evgeny-pasynkov commented 9 years ago

Pull request to fix it is not yet approved: https://github.com/mrniko/netty-socketio/issues/183

mrniko commented 9 years ago

@tormozok Please check whether this fix works?

mrniko commented 9 years ago

fixed in #183