Looking on the problem description and sources it looks to me that we
might miss a proper lifecycle call for transport/channel factory.
Yet from 0.9 release we do have proper implementation of
PlcDriver#close() which fires disconnect event handled by our netty
wrapper. I believe that its intention is to trigger termination of
active connection. Is this problem is confirmed for 0.9?
Best,
Łukasz
On 08.10.2021 19:25, Christofer Dutz wrote:
Forwarding again..
Holen Sie sich Outlook f?r Android<https://aka.ms/AAb9ysg>
________________________________
From: wq <[email protected]>
Sent: Thursday, October 7, 2021 5:53:51 AM
To: [email protected] <[email protected]>
Subject: plc4x bug question
class NettyChannelFactory
/**
* Event Loop Group to use.
* Has to be in accordance with {@link #getChannel()}
* otherwise a Runtime Exception will be produced by Netty
* <p>
* By Default Nettys {@link NioEventLoopGroup} is used.
* Transports which have to use a different EventLoopGroup have to override
{@link #getEventLoopGroup()}.
*/
public EventLoopGroup getEventLoopGroup() {
return new NioEventLoopGroup();
}
Memory leak problem: When the server is disconnected or restarted, the Netty
client reconnects, and the thread cannot be released, and increases each time.
When the number reaches a certain point, the program cannot connect.
[X]
Revised:
class NettyChannelFactory
private static NioEventLoopGroup nioEventLoopGroup = new NioEventLoopGroup();
/**
* Event Loop Group to use.
* Has to be in accordance with {@link #getChannel()}
* otherwise a Runtime Exception will be produced by Netty
* <p>
* By Default Nettys {@link NioEventLoopGroup} is used.
* Transports which have to use a different EventLoopGroup have to override
{@link #getEventLoopGroup()}.
*/
public EventLoopGroup getEventLoopGroup() {
if (nioEventLoopGroup == null || nioEventLoopGroup.isShutdown()) {
nioEventLoopGroup = new NioEventLoopGroup();
}
return nioEventLoopGroup;
}
The number of threads began to stabilize
[X]
I hope PLC4X will do better and better. In the process of use, I found many
problems, which are relatively basic. Seriously affect the use of production.