You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@plc4x.apache.org by "shekhartanwar (via GitHub)" <gi...@apache.org> on 2025/09/05 06:11:20 UTC
[I] [Bug]: S7 Read Request gets timed out after approximately 5-10 minutes
shekhartanwar opened a new issue, #2246:
URL: https://github.com/apache/plc4x/issues/2246
### What happened?
**Issue**
After upgrading to library version 0.13.0, my application, which reads 207 memory blocks from a PLC using the S7 protocol every second, starts throwing timeout exceptions after running for 5–10 minutes. With version 0.12.0, the application runs without issues.
**Expected behavior**
The application should continuously read all 207 memory blocks every second without timeout exceptions, as it does with version 0.12.0.
**Steps to reproduce**
1. Use library version 0.13.0.
2. Continuously read 207 memory blocks from a PLC every second.
3. Observe that after 5–10 minutes, timeout exceptions occur.
**Additional context**
In 0.12.0, I manually divided the 207 memory blocks into ~21 PlcReadRequests (max 20 blocks per request) using batching.
In 0.13.0, batching is handled internally by the library.
No other changes were made to the application code.
This issue blocks me from upgrading to 0.13.0.
**Environment**
Library version: 0.13.0 (works in 0.12.0)
Protocol: S7
Number of memory blocks: 207
Frequency: 1 read per second
### Version
v0.13.0
### Programming Languages
- [ ] plc4c
- [ ] plc4go
- [x] plc4j
- [ ] plc4net
- [ ] plc4py
### Protocols
- [ ] AB-Ethernet
- [ ] ADS /AMS
- [ ] BACnet/IP
- [ ] C-Bus
- [ ] CANopen
- [ ] EtherNet/IP
- [ ] Firmata
- [ ] IEC-69870
- [ ] KNXnet/IP
- [ ] Modbus
- [ ] OPC-UA
- [ ] Profinet
- [x] S7
- [ ] S7-light
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: Timeout Exceptions After 5–10 Minutes When Reading 207 Memory Blocks with S7 Protocol in v0.13.0 (Works in v0.12.0)
Posted by "chrisdutz (via GitHub)" <gi...@apache.org>.
chrisdutz commented on issue #2246:
URL: https://github.com/apache/plc4x/issues/2246#issuecomment-3257585873
Well ... does it generally work, or are you just seeing that in the logs and generally everything is working?
In general S7 devices are some times a little "bitchy" ... if they don't like something, they just hang up. So some times a bit might flip or the S7 thinks one flipped and it just hangs up .... especially under heavy network loads, I've seen that happen.
Are you using the connection cache or are you opening a connection for every request? I hope you're using the connection-cache, as that should handle the reconnects and also improve performance quite a bit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: Timeout Exceptions After 5–10 Minutes When Reading 207 Memory Blocks with S7 Protocol in v0.13.0 (Works in v0.12.0)
Posted by "chrisdutz (via GitHub)" <gi...@apache.org>.
chrisdutz commented on issue #2246:
URL: https://github.com/apache/plc4x/issues/2246#issuecomment-3257281430
So I think we added quite a bit of timeout handling in the general core. It might be that some if these are now firing. More than 200DBs every second is quite a lot.
The batching you are referring to, that I added due 0.13.0 is mainly tied to the s7-light driver. Could you please try using that instead? (just change the URL from s7:// to s7-light://
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: Timeout Exceptions After 5–10 Minutes When Reading 207 Memory Blocks with S7 Protocol in v0.13.0 (Works in v0.12.0)
Posted by "shekhartanwar (via GitHub)" <gi...@apache.org>.
shekhartanwar commented on issue #2246:
URL: https://github.com/apache/plc4x/issues/2246#issuecomment-3257337580
Hi @chrisdutz Yes s7-light is working fine with v0.13.1, but i am seeing below errors in the logs.
`2025-09-05T07:16:28.254Z ERROR 1 --- [ntLoopGroup-3-1] o.a.p.j.s.c.DefaultNettyPlcConnection : unknown error, close the connection
java.net.SocketException: Connection reset
`
`2025-09-05T07:16:30.242Z ERROR 1 --- [ool-24-thread-1] c.v.p.service.impl.PlcS7Service : Unexpected exception occurred during executing read request
java.util.concurrent.TimeoutException: null`
But it starts working again from next request.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: Timeout Exceptions After 5–10 Minutes When Reading 207 Memory Blocks with S7 Protocol in v0.13.0 (Works in v0.12.0)
Posted by "chrisdutz (via GitHub)" <gi...@apache.org>.
chrisdutz commented on issue #2246:
URL: https://github.com/apache/plc4x/issues/2246#issuecomment-3257949610
Hi,
yeah ... well you "technically" close it after doing your thing, but it doesn't really close, it but return it to the cache (and potentially waiting threads).
In your case I guess you have implemented part of the functionality. I just wanted to make sure that you don't expect the connection to be open indeffinitely. If you're checking things and potentially re-creating connections, you should be fine. But I guess your log output is simply the log of an operation failing and your code then creates a new connection the next time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: Timeout Exceptions After 5–10 Minutes When Reading 207 Memory Blocks with S7 Protocol in v0.13.0 (Works in v0.12.0)
Posted by "shekhartanwar (via GitHub)" <gi...@apache.org>.
shekhartanwar commented on issue #2246:
URL: https://github.com/apache/plc4x/issues/2246#issuecomment-3268844635
> Hello, Can you tell me how many bytes (on average) you're reading from each DB, and if it's not a problem, the CPU model with the assigned communications load? I'm in a remote location without much connectivity, but I have access to a CPU315 2PN/DP. I'm interested in evaluating that test. Best regards,
I am not sure of PLC Configuration because that is managed by some other team. I read approx. 250 bytes per second from single memory block with different offsets. **Correction:** Single DB with different offsets.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: Timeout Exceptions After 5–10 Minutes When Reading 207 Memory Blocks with S7 Protocol in v0.13.0 (Works in v0.12.0)
Posted by "chrisdutz (via GitHub)" <gi...@apache.org>.
chrisdutz commented on issue #2246:
URL: https://github.com/apache/plc4x/issues/2246#issuecomment-5294510567
The S7 driver has been completely rewritten ... this issue should no longer persist. Please test with the latest 1.0.0-SNAPSHOT branch and open a new issue if the problem should still persist (I doubt it)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: Timeout Exceptions After 5–10 Minutes When Reading 207 Memory Blocks with S7 Protocol in v0.13.0 (Works in v0.12.0)
Posted by "shekhartanwar (via GitHub)" <gi...@apache.org>.
shekhartanwar commented on issue #2246:
URL: https://github.com/apache/plc4x/issues/2246#issuecomment-3268875769
> Hi,
>
> yeah ... well you "technically" close it after doing your thing, but it doesn't really close, it but return it to the cache (and potentially waiting threads). In your case I guess you have implemented part of the functionality. I just wanted to make sure that you don't expect the connection to be open indeffinitely. If you're checking things and potentially re-creating connections, you should be fine. But I guess your log output is simply the log of an operation failing and your code then creates a new connection the next time.
Hello, I am seeing frequent connection resets with v0.13.1 s7-light driver. It reconnects within 1-2 seconds max, that's why i don't have a problem here, but i can't tolerate frequent connection resets.
Please check the logs below.
`
2025-09-09T09:25:41.995+05:30 | 2025-09-09T03:55:41.993Z ERROR 1 --- [oopGroup-1424-1] o.a.p.j.s.c.DefaultNettyPlcConnection : unknown error, close the connection
-- | --
| 2025-09-09T09:25:41.995+05:30 | java.net.SocketException: Connection reset
| 2025-09-09T09:25:41.995+05:30 | at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(Unknown Source) ~[na:na]
| 2025-09-09T09:25:41.995+05:30 | at java.base/sun.nio.ch.SocketChannelImpl.read(Unknown Source) ~[na:na]
| 2025-09-09T09:25:41.995+05:30 | at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:255) ~[netty-buffer-4.1.123.Final.jar!/:4.1.123.Final]
| 2025-09-09T09:25:41.995+05:30 | at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132) ~[netty-buffer-4.1.123.Final.jar!/:4.1.123.Final]
| 2025-09-09T09:25:41.995+05:30 | at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:356) ~[netty-transport-4.1.123.Final.jar!/:4.1.123.Final]
| 2025-09-09T09:25:41.995+05:30 | at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151) ~[netty-transport-4.1.123.Final.jar!/:4.1.123.Final]
| 2025-09-09T09:25:41.995+05:30 | at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:796) ~[netty-transport-4.1.123.Final.jar!/:4.1.123.Final]
| 2025-09-09T09:25:41.995+05:30 | at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:732) ~[netty-transport-4.1.123.Final.jar!/:4.1.123.Final]
| 2025-09-09T09:25:41.995+05:30 | at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:658) ~[netty-transport-4.1.123.Final.jar!/:4.1.123.Final]
| 2025-09-09T09:25:41.995+05:30 | at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) ~[netty-transport-4.1.123.Final.jar!/:4.1.123.Final]
| 2025-09-09T09:25:41.995+05:30 | at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:998) ~[netty-common-4.1.123.Final.jar!/:4.1.123.Final]
| 2025-09-09T09:25:41.995+05:30 | at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.123.Final.jar!/:4.1.123.Final]
| 2025-09-09T09:25:41.995+05:30 | at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.123.Final.jar!/:4.1.123.Final]
| 2025-09-09T09:25:41.995+05:30 | at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]
| 2025-09-09T09:25:41.996+05:30 | 2025-09-09T03:55:41.996Z INFO 1 --- [oopGroup-1424-1] o.a.p.j.s.c.NettyChannelFactory : Channel is closed, closing worker Group also
| 2025-09-09T09:25:42.092+05:30 | 2025-09-09T03:55:42.092Z INFO 1 --- [ool-14-thread-1] c.v.p.service.impl.PlcS7Service : Creating PLC Connection...
2025-09-09T09:25:42.092+05:30 | 2025-09-09T03:55:42.092Z INFO 1 --- [ool-14-thread-1] o.a.plc4x.java.DefaultPlcDriverManager : Instantiating new PLC Driver Manager with class loader null
-- | --
| 2025-09-09T09:25:42.092+05:30 | 2025-09-09T03:55:42.092Z INFO 1 --- [ool-14-thread-1] o.a.plc4x.java.DefaultPlcDriverManager : Registering available drivers...
| 2025-09-09T09:25:42.092+05:30 | 2025-09-09T03:55:42.092Z ERROR 1 --- [ool-14-thread-1] c.v.p.service.impl.PlcS7Service : Plc connect error : Unable to find driver for protocol 's7-light'
| 2025-09-09T09:25:42.092+05:30 | 2025-09-09T03:55:42.092Z ERROR 1 --- [ool-14-thread-1] c.v.p.watchdog.impl.WatchdogImpl : Exception occurred while initializing watchdog builder, Message : PLC connection is down
| 2025-09-09T09:25:42.093+05:30 | 2025-09-09T03:55:42.092Z ERROR 1 --- [ool-14-thread-1] c.v.p.service.impl.PlcS7Service : Exception occurred while executing write request, Message
| 2025-09-09T09:25:42.093+05:30 | java.lang.NullPointerException: null
| 2025-09-09T09:25:42.168+05:30 | 2025-09-09T03:55:42.168Z INFO 1 --- [ool-10-thread-1] c.v.p.service.impl.PlcS7Service : Creating PLC Connection...
| 2025-09-09T09:25:42.168+05:30 | 2025-09-09T03:55:42.168Z INFO 1 --- [ool-10-thread-1] o.a.plc4x.java.DefaultPlcDriverManager : Instantiating new PLC Driver Manager with class loader null
| 2025-09-09T09:25:42.168+05:30 | 2025-09-09T03:55:42.168Z INFO 1 --- [ool-10-thread-1] o.a.plc4x.java.DefaultPlcDriverManager : Registering available drivers...
| 2025-09-09T09:25:42.168+05:30 | 2025-09-09T03:55:42.168Z ERROR 1 --- [ool-10-thread-1] c.v.p.service.impl.PlcS7Service : Plc connect error : Unable to find driver for protocol 's7-light'
| 2025-09-09T09:25:42.168+05:30 | 2025-09-09T03:55:42.168Z ERROR 1 --- [ool-10-thread-1] c.v.p.watchdog.impl.WatchdogImpl : Exception occurred while initializing watchdog builder, Message : PLC connection is down
2025-09-09T09:25:42.655+05:30 | 2025-09-09T03:55:42.655Z INFO 1 --- [ scheduling-1] o.a.plc4x.java.DefaultPlcDriverManager : Registering available drivers...
-- | --
| 2025-09-09T09:25:42.657+05:30 | 2025-09-09T03:55:42.657Z INFO 1 --- [ scheduling-1] o.a.plc4x.java.DefaultPlcDriverManager : Registering driver for Protocol s7 (Siemens S7 (Basic))
| 2025-09-09T09:25:42.657+05:30 | 2025-09-09T03:55:42.657Z INFO 1 --- [ scheduling-1] o.a.plc4x.java.DefaultPlcDriverManager : Registering driver for Protocol s7-light (Siemens S7 (Basic) (light))
`
I can see error like `Unable to find driver for protocol 's7-light'` but in multiple retries it's able to find the driver.
I can also observe frequent connection resets throughout the day. This was not the case with 0.12.0 version. Is there anything else can i do here to improve the connection stability?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: Timeout Exceptions After 5–10 Minutes When Reading 207 Memory Blocks with S7 Protocol in v0.13.0 (Works in v0.12.0)
Posted by "shekhartanwar (via GitHub)" <gi...@apache.org>.
shekhartanwar commented on issue #2246:
URL: https://github.com/apache/plc4x/issues/2246#issuecomment-3257771917
> Well ... does it generally work, or are you just seeing that in the logs and generally everything is working? In general S7 devices are some times a little "bitchy" ... if they don't like something, they just hang up. So some times a bit might flip or the S7 thinks one flipped and it just hangs up .... especially under heavy network loads, I've seen that happen.
>
> Are you using the connection cache or are you opening a connection for every request? I hope you're using the connection-cache, as that should handle the reconnects and also improve performance quite a bit.
I am creating only 1 instance of PlcConnection and using it in all read/write requests, i have created a getConnection() method that whenever called checks if plcConnection.isConnected() then accordingly reconnects if not connected. But at the end, the connection object is Singleton. This connection stays open till it's automatically disconnected.
As fas as i understood, for using Connection Cache, i have to close connection every time so that all other threads can use it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: Timeout Exceptions After 5–10 Minutes When Reading 207 Memory Blocks with S7 Protocol in v0.13.0 (Works in v0.12.0)
Posted by "sruehl (via GitHub)" <gi...@apache.org>.
sruehl commented on issue #2246:
URL: https://github.com/apache/plc4x/issues/2246#issuecomment-3257278274
try 0.13.1
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: Timeout Exceptions After 5–10 Minutes When Reading 207 Memory Blocks with S7 Protocol in v0.13.0 (Works in v0.12.0)
Posted by "shekhartanwar (via GitHub)" <gi...@apache.org>.
shekhartanwar commented on issue #2246:
URL: https://github.com/apache/plc4x/issues/2246#issuecomment-3269575683
I created 2 PlcConnections for READ and WRITE operations and i can see now the connection reset happens only for READ operation.
```
2025-09-09T08:37:54.827Z INFO 1 --- [ool-26-thread-2] c.v.p.service.impl.PlcS7Service : Creating PLC Connection Type READ
--
2025-09-09T08:40:03.822Z INFO 1 --- [ool-26-thread-2] c.v.p.service.impl.PlcS7Service : Creating PLC Connection Type READ
2025-09-09T08:40:48.827Z INFO 1 --- [ool-26-thread-1] c.v.p.service.impl.PlcS7Service : Creating PLC Connection Type READ
2025-09-09T08:42:56.822Z INFO 1 --- [ool-26-thread-2] c.v.p.service.impl.PlcS7Service : Creating PLC Connection Type READ
2025-09-09T08:42:57.857Z INFO 1 --- [ool-26-thread-1] c.v.p.service.impl.PlcS7Service : Creating PLC Connection Type READ
```
Looks like the READ operation is causing PLC to close the connection.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: Timeout Exceptions After 5–10 Minutes When Reading 207 Memory Blocks with S7 Protocol in v0.13.0 (Works in v0.12.0)
Posted by "glcj (via GitHub)" <gi...@apache.org>.
glcj commented on issue #2246:
URL: https://github.com/apache/plc4x/issues/2246#issuecomment-3262096194
Hello,
Can you tell me how many bytes (on average) you're reading from each DB, and if it's not a problem, the CPU model with the assigned communications load?
I'm in a remote location without much connectivity, but I have access to a CPU315 2PN/DP.
I'm interested in evaluating that test.
Best regards,
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: Timeout Exceptions After 5–10 Minutes When Reading 207 Memory Blocks with S7 Protocol in v0.13.0 (Works in v0.12.0)
Posted by "chrisdutz (via GitHub)" <gi...@apache.org>.
chrisdutz closed issue #2246: [Bug]: Timeout Exceptions After 5–10 Minutes When Reading 207 Memory Blocks with S7 Protocol in v0.13.0 (Works in v0.12.0)
URL: https://github.com/apache/plc4x/issues/2246
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@plc4x.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org