You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@plc4x.apache.org by "bajiedewow (via GitHub)" <gi...@apache.org> on 2026/09/20 06:36:36 UTC
[I] [Bug]: read too many tags Error
bajiedewow opened a new issue, #2762:
URL: https://github.com/apache/plc4x/issues/2762
### What happened?
PlcReadRequest.Builder :
builder.build().execute().get(READ_TIMEOUT_MS, TimeUnit.MILLISECONDS);
deviceType : S7-1515
The are the points I have read :
status-1 %DB25000:450.0:INT
Alarm-1 %DB25000:452.0:INT
spare1-1 %DB25000:454.0:WORD
spare2-1 %DB25000:456.0:WORD
spare3-1 %DB25000:458.0:WORD
status-2 %DB25000:460.0:INT
Alarm-2 %DB25000:462.0:INT
spare1-2 %DB25000:464.0:WORD
spare2-2 %DB25000:466.0:WORD
spare3-2 %DB25000:468.0:WORD
Tag : p2087828733103394826 is : status-2 %DB25000:460.0:INT
`
2026-09-20T14:07:40.634+08:00 WARN 1193581 --- [TCP-Read-172.16.33.97:102] o.apache.plc4x.java.s7.S7CotpConnection : Error decoding tag p2087828733103394826
java.lang.ArrayIndexOutOfBoundsException: arraycopy: length -2 is negative
at org.apache.plc4x.java.s7.S7CotpConnection.decodeBindingInto(S7CotpConnection.java:734) ~[plc4j-driver-s7-1.0.0.jar!/:1.0.0]
at org.apache.plc4x.java.s7.S7CotpConnection.applyChunkResponse(S7CotpConnection.java:699) ~[plc4j-driver-s7-1.0.0.jar!/:1.0.0]
at org.apache.plc4x.java.s7.S7CotpConnection.lambda$sendReadChunk$19(S7CotpConnection.java:649) ~[plc4j-driver-s7-1.0.0.jar!/:1.0.0]
at java.base/java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:934) ~[na:na]
at java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:911) ~[na:na]
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[na:na]
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2179) ~[na:na]
at org.apache.plc4x.java.spi.drivers.throttle.RequestThrottle.lambda$start$1(RequestThrottle.java:121) ~[plc4j-spi-drivers-1.0.0.jar!/:1.0.0]
at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863) ~[na:na]
at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841) ~[na:na]
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[na:na]
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2179) ~[na:na]
at org.apache.plc4x.java.s7.S7CotpConnection.handleIncomingMessage(S7CotpConnection.java:502) ~[plc4j-driver-s7-1.0.0.jar!/:1.0.0]
at org.apache.plc4x.java.spi.drivers.MessageCodecBase.processIncomingData(MessageCodecBase.java:200) ~[plc4j-spi-drivers-1.0.0.jar!/:1.0.0]
at org.apache.plc4x.java.s7.S7CotpConnection.lambda$onConnect$0(S7CotpConnection.java:190) ~[plc4j-driver-s7-1.0.0.jar!/:1.0.0]
at org.apache.plc4x.java.transport.cotp.CotpTransportInstance.lambda$setupAsyncEventPropagation$0(CotpTransportInstance.java:124) ~[plc4j-transports-cotp-1.0.0.jar!/:1.0.0]
at org.apache.plc4x.java.transport.tcp.TcpTransportInstance.safeRun(TcpTransportInstance.java:374) ~[plc4j-transports-tcp-1.0.0.jar!/:1.0.0]
at org.apache.plc4x.java.transport.tcp.TcpTransportInstance.runReadLoop(TcpTransportInstance.java:423) ~[plc4j-transports-tcp-1.0.0.jar!/:1.0.0]
at java.base/java.lang.VirtualThread.run(VirtualThread.java:309) ~[na:na]
`
What is the reason? How should I handle it?
thank you!
### Version
V 1.0.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
- [ ] PLC4X
- [ ] Profinet
- [x] S7
- [ ] Simulated
- [ ] SLMP
- [ ] UMAS
--
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]: read too many tags Error
Posted by "chrisdutz (via GitHub)" <gi...@apache.org>.
chrisdutz closed issue #2762: [Bug]: read too many tags Error
URL: https://github.com/apache/plc4x/issues/2762
--
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]: read too many tags Error
Posted by "chrisdutz (via GitHub)" <gi...@apache.org>.
chrisdutz commented on issue #2762:
URL: https://github.com/apache/plc4x/issues/2762#issuecomment-5751207600
Thanks for the report — this is a real bug in the 1.0.0 S7 driver, and you reproduced it just by reading enough tags.
What happens: the driver merges tags that sit close together in the same DB into a single block read, so your contiguous %DB25000:450, 452, 454, … addresses all collapse into one big byte read. That merge had no size limit, so once the run got longer than one PDU the block was split into PDU-sized fragments —
but every fragment was still decoded with the offsets of the whole block. For status-2 at block offset 10, a fragment that only carried 8 bytes gives 8 - 10 = -2, which is the arraycopy: length -2 is negative you see.
Important: the exception is only the visible half. Tags whose offset happened to fall inside a later fragment were decoded from the wrong part of the DB and reported as OK. So with a request this large on 1.0.0, please treat all values from that request as suspect, not just the ones that logged a warning.
Workaround on 1.0.0: split the read into several requests so that no contiguous run of addresses exceeds the negotiated PDU payload (staying under ~400 bytes per request is safe with the usual 480-byte PDU). There is no configuration option to turn the block merging off.
Fix: merging now stops before a block outgrows a single response item, so it is never fragmented, and the per-tag offsets are additionally rebased on the read they belong to — a tag a read does not fully cover is reported as an error instead of being filled with foreign bytes. Regression tests cover both. This
is on develop and will be part of the next release; there are no plans for a 1.0.1, so 1.0.0 users should use the workaround above until then.
Please try 1.1.0-SNAPSHOT, if this fix works.
--
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