Howdy. I am seeing a persistent thread being created for every
plcConnection connect which looks like the following:

Name: nioEventLoopGroup-11-1
State: RUNNABLE
Total blocked: 0  Total waited: 0

Stack trace:
java.base@13.0.2/sun.nio.ch.EPoll.wait(Native Method)
java.base@13.0.2
/sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:120)
java.base@13.0.2
/sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:124)
   - locked io.netty.channel.nio.SelectedSelectionKeySet@f6df6b
   - locked sun.nio.ch.EPollSelectorImpl@7ffc19
java.base@13.0.2/sun.nio.ch.SelectorImpl.select(SelectorImpl.java:141)
app//io.netty.channel.nio.SelectedSelectionKeySetSelector.select(SelectedSelectionKeySetSelector.java:68)
app//io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:803)
app//io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:457)
app//io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
app//io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
app//io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
java.base@13.0.2/java.lang.Thread.run(Thread.java:830)


This happens both when creating a connection directly or when using the
plc4x connection pool.

In both cases I am obtaining the connection, reading some modbus values,
and then closing the connection. From the plcConnection metadata the
connection type I am using is:

org.apache.plc4x.java.spi.connection.DefaultNettyPlcConnection

Over time thousands of these nioEventLoopGroup threads are created and I
experience an OutOfMemory error in my program.

Has anyone experienced this problem? Is there a way to force these threads
to close, timeout, or to specify the total thread limit?

Thanks and Regards, Adam

Reply via email to