[
https://issues.apache.org/jira/browse/PLC4X-359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17626211#comment-17626211
]
StrawberryBlue commented on PLC4X-359:
--------------------------------------
{code:java}
builder.addItem("value-1", "40001[100]");
builder.addItem("value-2", "40101[20]");
builder.addItem("value-3", "40131[20]"); {code}
I read 300 shaping data from a slave station. The code is as above. It can be
reproduced after several times of cyclic reading.
> The modbus rtu loop reads a large amount of data, causing a half packet
> problem
> -------------------------------------------------------------------------------
>
> Key: PLC4X-359
> URL: https://issues.apache.org/jira/browse/PLC4X-359
> Project: Apache PLC4X
> Issue Type: Bug
> Components: Driver-Modbus
> Affects Versions: 0.10.0
> Environment: jdk17
> Reporter: StrawberryBlue
> Priority: Critical
>
> {code:java}
> 2022-10-29 00:09:21.362 WARN --- [ntLoopGroup-2-1]
> .p.j.s.GeneratedDriverByteToMessageCodec : Error decoding package with
> content
> [0103c80fea000000000fe4000000000000000000000fdf00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000]:
> Index 180 out of bounds for length
> 180java.lang.ArrayIndexOutOfBoundsException: Index 180 out of bounds for
> length 180
> at com.github.jinahya.bit.io.ArrayByteInput.read(ArrayByteInput.java:106)
> at com.github.jinahya.bit.io.DefaultBitInput.read(DefaultBitInput.java:57)
> at
> com.github.jinahya.bit.io.AbstractBitInput.unsigned8(AbstractBitInput.java:63)
> at
> com.github.jinahya.bit.io.AbstractBitInput.unsigned16(AbstractBitInput.java:92)
> at
> com.github.jinahya.bit.io.AbstractBitInput.readInt(AbstractBitInput.java:135)
> at
> com.github.jinahya.bit.io.AbstractBitInput.readInt(AbstractBitInput.java:118)
> at
> com.github.jinahya.bit.io.AbstractBitInput.readByte(AbstractBitInput.java:106)
> at
> org.apache.plc4x.java.spi.generation.ReadBufferByteBased.readSignedByte(ReadBufferByteBased.java:235)
> at
> org.apache.plc4x.java.spi.generation.ReadBuffer.readByte(ReadBuffer.java:44)
> at
> org.apache.plc4x.java.spi.generation.ReadBufferByteBased.readByteArray(ReadBufferByteBased.java:126)
> at
> org.apache.plc4x.java.modbus.readwrite.ModbusPDUReadHoldingRegistersResponse.staticParseBuilder(ModbusPDUReadHoldingRegistersResponse.java:112)
> at
> org.apache.plc4x.java.modbus.readwrite.ModbusPDU.staticParse(ModbusPDU.java:173)
> at
> org.apache.plc4x.java.modbus.readwrite.ModbusRtuADU.lambda$staticParseBuilder$0(ModbusRtuADU.java:135)
> at
> org.apache.plc4x.java.spi.codegen.io.DataReaderComplexDefault.read(DataReaderComplexDefault.java:70)
> at
> org.apache.plc4x.java.spi.codegen.io.DataReaderComplexDefault.read(DataReaderComplexDefault.java:61)
> at
> org.apache.plc4x.java.spi.codegen.fields.FieldReaderSimple.lambda$readSimpleField$0(FieldReaderSimple.java:34)
> at
> org.apache.plc4x.java.spi.codegen.FieldCommons.switchParseByteOrderIfNecessary(FieldCommons.java:69)
> at
> org.apache.plc4x.java.spi.codegen.fields.FieldReaderSimple.readSimpleField(FieldReaderSimple.java:34)
> at
> org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.readSimpleField(FieldReaderFactory.java:129)
> at
> org.apache.plc4x.java.modbus.readwrite.ModbusRtuADU.staticParseBuilder(ModbusRtuADU.java:132)
> at
> org.apache.plc4x.java.modbus.readwrite.ModbusADU.staticParse(ModbusADU.java:121)
> at
> org.apache.plc4x.java.modbus.readwrite.ModbusADU.staticParse(ModbusADU.java:106)
> at
> org.apache.plc4x.java.modbus.rtu.ModbusRtuDriver.lambda$getStackConfigurer$0(ModbusRtuDriver.java:107)
> at
> org.apache.plc4x.java.spi.GeneratedDriverByteToMessageCodec.decode(GeneratedDriverByteToMessageCodec.java:87)
> at
> io.netty.handler.codec.ByteToMessageCodec$1.decode(ByteToMessageCodec.java:42)
> at
> io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:510)
> at
> io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:449)
> at
> io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:279)
> at
> io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
> at
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
> at
> io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
> at
> io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
> at
> org.apache.plc4x.java.transport.serial.SerialChannel$SerialNioUnsafe.read(SerialChannel.java:289)
> at
> io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
> at
> io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:623)
> at
> io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:586)
> at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
> at
> io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:995)
> 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:833)2022-10-29 00:09:21.363
> WARN --- [ntLoopGroup-2-1] .p.j.s.GeneratedDriverByteToMessageCodec :
> Error decoding package with content
> [0000000000000000000000000000000000000000000000426f]: Unsupported case for
> discriminated type parameters [errorFlag=false functionFlag=0
> response=true]org.apache.plc4x.java.spi.generation.ParseException:
> Unsupported case for discriminated type parameters [errorFlag=false
> functionFlag=0 response=true]
> at
> org.apache.plc4x.java.modbus.readwrite.ModbusPDU.staticParse(ModbusPDU.java:286)
> at
> org.apache.plc4x.java.modbus.readwrite.ModbusRtuADU.lambda$staticParseBuilder$0(ModbusRtuADU.java:135)
> at
> org.apache.plc4x.java.spi.codegen.io.DataReaderComplexDefault.read(DataReaderComplexDefault.java:70)
> at
> org.apache.plc4x.java.spi.codegen.io.DataReaderComplexDefault.read(DataReaderComplexDefault.java:61)
> at
> org.apache.plc4x.java.spi.codegen.fields.FieldReaderSimple.lambda$readSimpleField$0(FieldReaderSimple.java:34)
> at
> org.apache.plc4x.java.spi.codegen.FieldCommons.switchParseByteOrderIfNecessary(FieldCommons.java:69)
> at
> org.apache.plc4x.java.spi.codegen.fields.FieldReaderSimple.readSimpleField(FieldReaderSimple.java:34)
> at
> org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.readSimpleField(FieldReaderFactory.java:129)
> at
> org.apache.plc4x.java.modbus.readwrite.ModbusRtuADU.staticParseBuilder(ModbusRtuADU.java:132)
> at
> org.apache.plc4x.java.modbus.readwrite.ModbusADU.staticParse(ModbusADU.java:121)
> at
> org.apache.plc4x.java.modbus.readwrite.ModbusADU.staticParse(ModbusADU.java:106)
> at
> org.apache.plc4x.java.modbus.rtu.ModbusRtuDriver.lambda$getStackConfigurer$0(ModbusRtuDriver.java:107)
> at
> org.apache.plc4x.java.spi.GeneratedDriverByteToMessageCodec.decode(GeneratedDriverByteToMessageCodec.java:87)
> at
> io.netty.handler.codec.ByteToMessageCodec$1.decode(ByteToMessageCodec.java:42)
> at
> io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:510)
> at
> io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:449)
> at
> io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:279)
> at
> io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
> at
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
> at
> io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
> at
> io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
> at
> org.apache.plc4x.java.transport.serial.SerialChannel$SerialNioUnsafe.read(SerialChannel.java:289)
> at
> io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
> at
> io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:623)
> at
> io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:586)
> at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
> at
> io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:995)
> 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:833)
> {code}
>
> When I use modbus rtu to read 300 pieces of data, divided into four items for
> reading, half package will occur, causing the program to terminate
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)