frankpuppa opened a new issue, #2277:
URL: https://github.com/apache/plc4x/issues/2277

   ### What happened?
   
   Hello, 
   I noticed an error that occurs when reading multiple variables from the same 
address. I’m not sure if this is a common practice when working with PLCs, but 
I encountered it while reading variables from an S7-1200 PLC.. 
   Here are the steps to reproduce this error
   
   example of a list of variables to read:
   ```
   1,"RT_CNT_P","%MB1131","BYTE"
   2,"RT_CNT_P_0","%M1131.0","BOOL"
   3,"RT_CNT_P_1","%M1131.1","BOOL"
   4,"RT_CNT_P_2","%M1131.2","BOOL"
   5,"RT_CNT_P_3","%M1131.3","BOOL"
   6,"RT_CNT_P_4","%M1131.4","BOOL"
   7,"RT_CNT_P_5","%M1131.5","BOOL"
   8,"RT_CNT_P_6","%M1131.6","BOOL"
   9,"RT_CNT_P_7","%M1131.7","BOOL"
   ```
   As you can see the variables share the same memory address, MB1131
   
   Error:
   ```
   org.apache.plc4x.java.api.exceptions.PlcInvalidTagException: RT_CNT_P invalid
        at 
org.apache.plc4x.java.spi.messages.DefaultPlcReadResponse.getResponseCode(DefaultPlcReadResponse.java:120)
        at 
org.apache.plc4x.examples.s7.S7Test.lambda$printPlcResponse$2(S7Test.java:120)
        at java.base/java.lang.Iterable.forEach(Iterable.java:75)
        at org.apache.plc4x.examples.s7.S7Test.printPlcResponse(S7Test.java:118)
        at org.apache.plc4x.examples.s7.S7Test.lambda$update$0(S7Test.java:88)
        at 
java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
        at 
java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
        at 
java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
        at 
java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2179)
        at 
org.apache.plc4x.java.spi.optimizer.BaseOptimizer.lambda$8(BaseOptimizer.java:206)
        at 
java.base/java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:934)
        at 
java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:911)
        at 
java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
        at 
java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2179)
        at 
org.apache.plc4x.java.s7light.readwrite.protocol.S7ProtocolLogic.lambda$14(S7ProtocolLogic.java:212)
        at 
java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
        at 
java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
        at 
java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
        at 
java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2179)
        at 
org.apache.plc4x.java.s7light.readwrite.protocol.S7ProtocolLogic.lambda$26(S7ProtocolLogic.java:518)
        at 
java.base/java.util.function.Consumer.lambda$andThen$0(Consumer.java:65)
        at 
org.apache.plc4x.java.spi.Plc4xNettyWrapper.decode(Plc4xNettyWrapper.java:194)
        at 
io.netty.handler.codec.MessageToMessageCodec$1.decode(MessageToMessageCodec.java:67)
        at 
io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:91)
        at 
io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:120)
        at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
        at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
        at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
        at 
io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:107)
        at 
io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:120)
        at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
        at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
        at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
        at 
io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
        at 
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
        at 
io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103)
        at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
        at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
        at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
        at 
io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1357)
        at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
        at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
        at 
io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:868)
        at 
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
        at 
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:796)
        at 
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:732)
        at 
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:658)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
        at 
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:998)
        at 
io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:1583)
   ```
   For the time being, I’ve made a quick fix that seems to work for this 
specific use case. Unfortunately, I haven’t been able to test it thoroughly, as 
I don’t have access to a device to properly validate it. If you’re open to it, 
I can open a PR. Here are the changes: 
[commit](https://github.com/apache/plc4x/commit/72f8dfecd0ad2897fb5a9e6c98de81289441909d)
   
   
   ### 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
   - [ ] S7
   - [x] 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-unsubscr...@plc4x.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to