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

After about 24 hours of operation, starting the client before reading and closing after reading in 60s intervals, I get an endless loop of the client cannot be started because there is a timeout on closing #8

Closed
msqr opened this issue Jul 28, 2023 · 4 comments
Assignees

Comments

@msqr
Copy link
Contributor

msqr commented Jul 28, 2023

          After about 24 hours of operation, starting the client before reading and closing after reading in 60s intervals, I get an endless loop of the client cannot be started because there is a timeout on closing
Jul 28 19:16:52 boneio-2 java[30152]: 19:16:52.537 [sbc2ha-1-thread-1             ] WARN  arnetwork.io.modbus.rtu.netty.RtuNettyModbusClient::stop                                - Timeout waiting for /dev/ttyS4 9600 8N1 EventLoopGroup to shutdown
Jul 28 19:16:52 boneio-2 java[30152]: 19:16:52.576 [sbc2ha-1-thread-1             ] ERROR com.dfi.sbc2ha.modbus.Modbus                      ::readMany                            - read many: java.util.concurrent.ExecutionException: java.util.concu
Jul 28 19:16:52 boneio-2 java[30152]:         at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
Jul 28 19:16:52 boneio-2 java[30152]:         at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2069)
Jul 28 19:16:52 boneio-2 java[30152]:         at com.dfi.sbc2ha.modbus.Modbus.readMany(Modbus.java:85)
Jul 28 19:16:52 boneio-2 java[30152]:         at com.dfi.sbc2ha.sensor.modbus.ModbusSensor.run(ModbusSensor.java:99)
Jul 28 19:16:52 boneio-2 java[30152]:         at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
Jul 28 19:16:52 boneio-2 java[30152]:         at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
Jul 28 19:16:52 boneio-2 java[30152]:         at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
Jul 28 19:16:52 boneio-2 java[30152]:         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
Jul 28 19:16:52 boneio-2 java[30152]:         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
Jul 28 19:16:52 boneio-2 java[30152]:         at java.base/java.lang.Thread.run(Thread.java:831)
Jul 28 19:16:52 boneio-2 java[30152]: Caused by: java.util.concurrent.RejectedExecutionException: shutting down
Jul 28 19:16:52 boneio-2 java[30152]:         at io.netty.channel.ThreadPerChannelEventLoopGroup.nextChild(ThreadPerChannelEventLoopGroup.java:308)
Jul 28 19:16:52 boneio-2 java[30152]:         at io.netty.channel.ThreadPerChannelEventLoopGroup.register(ThreadPerChannelEventLoopGroup.java:277)
Jul 28 19:16:52 boneio-2 java[30152]:         at io.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:323)
Jul 28 19:16:52 boneio-2 java[30152]:         at io.netty.bootstrap.Bootstrap.doResolveAndConnect(Bootstrap.java:155)
Jul 28 19:16:52 boneio-2 java[30152]:         at io.netty.bootstrap.Bootstrap.connect(Bootstrap.java:116)
Jul 28 19:16:52 boneio-2 java[30152]:         at net.solarnetwork.io.modbus.rtu.netty.RtuNettyModbusClient.connect(RtuNettyModbusClient.java:177)
Jul 28 19:16:52 boneio-2 java[30152]:         at net.solarnetwork.io.modbus.netty.handler.NettyModbusClient.handleConnect(NettyModbusClient.java:238)
Jul 28 19:16:52 boneio-2 java[30152]:         at net.solarnetwork.io.modbus.netty.handler.NettyModbusClient.start(NettyModbusClient.java:185)

Originally posted by @dafik in #7 (comment)

@msqr msqr self-assigned this Jul 28, 2023
msqr added a commit that referenced this issue Jul 28, 2023
…rrectly handle test after shutdownGracefully() called but group has not yet shutdown, re #8.
@msqr
Copy link
Contributor Author

msqr commented Jul 28, 2023

Hey @dafik I pushed a change, could you test if that fixes the endless loop?

I think I will also update the stop() API to return a Future, so you have access to any exception that occurs during the shutdown process... I'll work on that separately.

@msqr
Copy link
Contributor Author

msqr commented Oct 19, 2023

Hi @dafik I wondered if you had any updated information on this issue; I will close it soon from inactivity otherwise.

@dafik
Copy link

dafik commented Oct 26, 2023

This seems to have solved the problem, I haven't seen this problem since

@msqr
Copy link
Contributor Author

msqr commented Oct 26, 2023

Awesome! Thanks for the feedback, I'll close this now.

@msqr msqr closed this as completed Oct 26, 2023
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

No branches or pull requests

2 participants