Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESLFrameDecoder Memory Leak and Outbound Deadlock Issue #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ykalayy
Copy link

@ykalayy ykalayy commented Apr 29, 2022

Motivation:
The problem with ESLFrameDecoder is creating another byteBuff with readBytes but doesn't release it.
Change: The reference count of the new bytebuff is aligned with the existing ones from the ReplayingDecoder(We can also call RefrenceCountUtil for that bytebuf rather than replace readBytes with readslices).

Another problem with outbound phases. Whenever a user tries to run any command with the given context. It uses a netty event-loop thread. Which causes a possible deadlock issue.

LEAK TRACE:
2022-04-27 08:02:44.633 ERROR 8 --- [ntLoopGroup-2-1] io.netty.util.ResourceLeakDetector : LEAK: ByteBuf.release() was not called before it's garbage-collected. See https://netty.io/wiki/reference-counted-objects.html for more information.
Recent access records:
Created at:
io.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:349)
io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:187)
io.netty.buffer.AbstractByteBufAllocator.buffer(AbstractByteBufAllocator.java:123)
io.netty.buffer.AbstractByteBuf.readBytes(AbstractByteBuf.java:879)
io.netty.handler.codec.ReplayingDecoderByteBuf.readBytes(ReplayingDecoderByteBuf.java:577)
org.freeswitch.esl.client.transport.message.EslFrameDecoder.decode(EslFrameDecoder.java:139)
io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:505)
io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366)
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:283)
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1421)
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930)
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:697)
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:632)
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:549)
io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:511)
io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:918)
io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
java.lang.Thread.run(Thread.java:748)

@ykalayy
Copy link
Author

ykalayy commented Apr 29, 2022

Hi @mgodave. Is that repository read-only or abandoned

esl-client#23 Outbound deadlock is fixed
esl-client#13 Outbound deadlock is fixed
@ykalayy
Copy link
Author

ykalayy commented May 5, 2022

@Turbo87

@Turbo87
Copy link
Contributor

Turbo87 commented May 5, 2022

sorry, it's been 7 years since I last used this and I'm no longer at a company that uses it :-/

@ykalayy
Copy link
Author

ykalayy commented May 5, 2022

@Turbo87
I see. At least thanks for the response 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants