Definitely seems to make sense from my perspective ... 
but we would probably have to update all of the overriding types too.

Chris


-----Ursprüngliche Nachricht-----
Von: Christofer Dutz <christofer.d...@c-ware.de> 
Gesendet: Donnerstag, 7. Oktober 2021 15:29
An: dev@plc4x.apache.org; Julian Feinauer (j.feina...@pragmaticminds.de) 
<j.feina...@pragmaticminds.de>
Betreff: WG: plc4x bug question

I found this in my spam directory ...

Any comments on this? @Julian Feinauer ... you're the Netty Guru here? ;-)

Chris

-----Ursprüngliche Nachricht-----
Von: wq <wilyq...@163.com> 
Gesendet: Donnerstag, 7. Oktober 2021 05:54
An: dev-ow...@plc4x.apache.org
Betreff: 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.


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




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.


 

Reply via email to