plc4x icon indicating copy to clipboard operation
plc4x copied to clipboard

[Bug]: modbusrtu is not success now

Open StrawberryBlue opened this issue 2 years ago • 15 comments

What happened?

15:39:33.278 [main] INFO  DefaultPlcDriverManager - Instantiating new PLC Driver Manager with class loader jdk.internal.loader.ClassLoaders$AppClassLoader@71bc1ae4
15:39:33.279 [main] INFO  DefaultPlcDriverManager - Registering available drivers...
15:39:33.290 [main] INFO  DefaultPlcDriverManager - Registering driver for Protocol modbus-ascii (Modbus ASCII)
15:39:33.291 [main] INFO  DefaultPlcDriverManager - Registering driver for Protocol modbus-rtu (Modbus RTU)
15:39:33.292 [main] INFO  DefaultPlcDriverManager - Registering driver for Protocol modbus-tcp (Modbus TCP)
15:39:34.211 [main] INFO  Plc4j - Synchronous request ...
15:39:39.719 [main] INFO  NettyChannelFactory - Channel is closed, closing worker Group also
15:39:39.736 [nioEventLoopGroup-2-1] WARN  NioEventLoop - Selector.select() returned prematurely 512 times in a row; rebuilding Selector org.apache.plc4x.java.transport.serial.SerialPollingSelector@34a12a3b.
15:39:39.737 [nioEventLoopGroup-2-1] INFO  NioEventLoop - Migrated 1 channel(s) to the new Selector.
15:39:39.739 [nioEventLoopGroup-2-1] WARN  NioEventLoop - Selector.select() returned prematurely 512 times in a row; rebuilding Selector org.apache.plc4x.java.transport.serial.SerialPollingSelector@571bf3f7.
15:39:39.739 [nioEventLoopGroup-2-1] INFO  NioEventLoop - Migrated 1 channel(s) to the new Selector.
15:39:39.740 [nioEventLoopGroup-2-1] WARN  NioEventLoop - Selector.select() returned prematurely 512 times in a row; rebuilding Selector org.apache.plc4x.java.transport.serial.SerialPollingSelector@14871804.
15:39:39.740 [nioEventLoopGroup-2-1] INFO  NioEventLoop - Migrated 1 channel(s) to the new Selector.
15:39:39.741 [nioEventLoopGroup-2-1] WARN  NioEventLoop - Selector.select() returned prematurely 512 times in a row; rebuilding Selector org.apache.plc4x.java.transport.serial.SerialPollingSelector@10d8ef59.

Now the ModbusRTU cannot run correctly.

Version

v0.11.0

Programming Languages

  • [X] plc4j
  • [ ] plc4go
  • [ ] plc4c
  • [ ] plc4net

Protocols

  • [ ] AB-Ethernet
  • [ ] ADS /AMS
  • [ ] BACnet/IP
  • [ ] CANopen
  • [ ] DeltaV
  • [ ] DF1
  • [ ] EtherNet/IP
  • [ ] Firmata
  • [ ] KNXnet/IP
  • [X] Modbus
  • [ ] OPC-UA
  • [ ] S7

StrawberryBlue avatar Nov 17 '23 07:11 StrawberryBlue

I think the serial transports need a bit of testing ... unfortunately my previous setup seems to be unavailable to me and I'm struggling a bit with testing.

Could you please give version 0.12.0-SNAPSHOT a try, as we already addressed some configuration issues for serial there.

chrisdutz avatar Nov 17 '23 08:11 chrisdutz

Ok .. so I've spotted an error in the Serial Transports and fixed it ... currently looking for a Serial Modbus device to do some further testing, but could you please test the latest SNAPSHOT version?

chrisdutz avatar Feb 06 '24 09:02 chrisdutz

Ok ... so I've tweaked quite a bit of stuff around the Serial Transport and Modbus in general ... could you please give this another try and tell us if it's working now?

chrisdutz avatar Feb 10 '24 13:02 chrisdutz

I tried using the 0.12 version, but it says that the transfer serial is not supported, is there something that has happened to the connection string

StrawberryBlue avatar Feb 20 '24 11:02 StrawberryBlue

MODBUS_RTU_CONNECT_OPTION = "modbus-rtu:serial://COM30?request-timeout=5000&unit-identifier=1&baud-rate=9600&num-data-bits=8&num-stop-bits=1&parity=NO_PARITY";

StrawberryBlue avatar Feb 20 '24 11:02 StrawberryBlue

If you are using 0.12.0, then please have a look at the online documentation. The parameters for baud-rate etc need a prefix now

chrisdutz avatar Feb 20 '24 12:02 chrisdutz

sorry,it also exist when i use

MODBUS_RTU_CONNECT_OPTION = "modbus-rtu:serial://COM30?request-timeout=5000&unit-identifier=1&serial.baud-rate=9600&serial.num-data-bits=8&serial.num-stop-bits=1&serial.parity=NO_PARITY";

StrawberryBlue avatar Feb 20 '24 14:02 StrawberryBlue

What type of device are you trying to communicate with?

Gesendet von Outlook für Androidhttps://aka.ms/AAb9ysg


From: StrawberryBlue @.> Sent: Tuesday, February 20, 2024 3:05:00 PM To: apache/plc4x @.> Cc: Christofer Dutz @.>; Assign @.> Subject: Re: [apache/plc4x] [Bug]: modbusrtu is not success now (Issue #1212)

sorry,it also exist when i use

MODBUS_RTU_CONNECT_OPTION = "modbus-rtu:serial://COM30?request-timeout=5000&unit-identifier=1&serial.baud-rate=9600&serial.num-data-bits=8&serial.num-stop-bits=1&serial.parity=NO_PARITY";

— Reply to this email directly, view it on GitHubhttps://github.com/apache/plc4x/issues/1212#issuecomment-1954285165, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAE66YLPSMVAGUABKYQUZYTYUSUQZAVCNFSM6AAAAAA7PL2LTKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJUGI4DKMJWGU. You are receiving this because you were assigned.Message ID: @.***>

chrisdutz avatar Feb 20 '24 14:02 chrisdutz

I am using a serial device on Windows, `public static String MODBUS_RTU_CONNECT_OPTION = "modbus-rtu:serial://COM30?request-timeout=5000&unit-identifier=1&serial.baud-rate=9600&serial.num-data-bits=8&serial.num-stop-bits=1&serial.parity=NO_PARITY"; public static String MODBUS_TCP_CONNECT_OPTION = "modbus-tcp:tcp://127.0.0.1:502";

@Test
public void modbusRtuRead(){
    try (PlcConnection connection = PlcDriverManager.getDefault().getConnectionManager().getConnection(MODBUS_RTU_CONNECT_OPTION)) {
        // Check if this connection support reading of data.
        if (!connection.getMetadata().isReadSupported()) {
            log.error("This connection doesn't support reading.");
            return;
        }

        PlcReadRequest.Builder builder = connection.readRequestBuilder();
        builder.addTagAddress("value-1", "400001:UINT[10]");
        PlcReadRequest readRequest = builder.build();

        PlcReadResponse response = readRequest.execute().get(5000, TimeUnit.MILLISECONDS);


        for (String tagName : response.getTagNames()) {
            if(response.getResponseCode(tagName) == PlcResponseCode.OK) {
                int numValues = response.getNumberOfValues(tagName);
                // If it's just one element, output just one single line.
                if(numValues == 1) {
                    log.info("Value[" + tagName + "]: " + response.getObject(tagName));
                }
                // If it's more than one element, output each in a single row.
                else {
                    log.info("Value[" + tagName + "]:");
                    for(int i = 0; i < numValues; i++) {
                        log.info(" - " + response.getObject(tagName, i));
                    }
                }
            }
            // Something went wrong, to output an error message instead.
            else {
                log.error("Error[" + tagName + "]: " + response.getResponseCode(tagName).name());
            }
        }

    }catch (Exception e){
        e.printStackTrace();
        log.error("connect fail");
    }
}`

Like the code , when attempting to establish a connection, the program throws an exception. 2024-02-21T08:16:30.878+08:00 INFO 3276 --- [ main] o.a.plc4x.java.DefaultPlcDriverManager : Instantiating new PLC Driver Manager with class loader jdk.internal.loader.ClassLoaders$AppClassLoader@2b193f2d 2024-02-21T08:16:30.879+08:00 INFO 3276 --- [ main] o.a.plc4x.java.DefaultPlcDriverManager : Registering available drivers... 2024-02-21T08:16:30.884+08:00 INFO 3276 --- [ main] o.a.plc4x.java.DefaultPlcDriverManager : Registering driver for Protocol modbus-ascii (Modbus ASCII) 2024-02-21T08:16:30.885+08:00 INFO 3276 --- [ main] o.a.plc4x.java.DefaultPlcDriverManager : Registering driver for Protocol modbus-rtu (Modbus RTU) 2024-02-21T08:16:30.886+08:00 INFO 3276 --- [ main] o.a.plc4x.java.DefaultPlcDriverManager : Registering driver for Protocol modbus-tcp (Modbus TCP) 2024-02-21T08:16:30.889+08:00 INFO 3276 --- [ main] o.a.plc4x.java.DefaultPlcDriverManager : Registering driver for Protocol s7 (Siemens S7 (Basic)) org.apache.plc4x.java.api.exceptions.PlcConnectionException: Unsupported transport serial

StrawberryBlue avatar Feb 21 '24 00:02 StrawberryBlue

It looks like the transport attribute does not support serial.

StrawberryBlue avatar Feb 21 '24 00:02 StrawberryBlue

I debugged the code and it seems that TcpTransport was used instead of SerialTransport.class, so I manually introduced the plc4j-transport-serial package. At this point, the data can be successfully read once, followed by frequent occurrences of Select. select() returned accurately 512 times in a row; Rebuilding selector org.apache.plc4x.java.transport.serial.SerialPollingSelector@4954bfd. Warning, preventing the program from continuing to execute normally.

StrawberryBlue avatar Feb 22 '24 01:02 StrawberryBlue

I continued to check the input logs, and it seems that the previous agent closed the channel after reading it onceChannel is closed, closing worker Group also. So I adjusted the code and looped read the data before it was closed. At this point, the data can be read correctly. Thank you for your help.

StrawberryBlue avatar Feb 22 '24 01:02 StrawberryBlue

I continued testing, and when I looped read the data, there was an incomplete message. The test code is as follows ` @Test public void modbusRtuRead(){ try (PlcConnection connection = PlcDriverManager.getDefault().getConnectionManager().getConnection(MODBUS_RTU_CONNECT_OPTION)) {

        while (true) {
            // Check if this connection support reading of data.
            if (!connection.getMetadata().isReadSupported()) {
                log.error("This connection doesn't support reading.");
                return;
            }
            PlcReadRequest.Builder builder = connection.readRequestBuilder();
            builder.addTagAddress("value-1", "400001:UINT[100]");
            PlcReadRequest readRequest = builder.build();
            long start = System.currentTimeMillis();
            PlcReadResponse response = null;

            response = readRequest.execute().get(5000, TimeUnit.MILLISECONDS);

            if (response != null) {
                for (String tagName : response.getTagNames()) {
                    if (response.getResponseCode(tagName) == PlcResponseCode.OK) {
                        int numValues = response.getNumberOfValues(tagName);
                        // If it's just one element, output just one single line.
                        if (numValues == 1) {
                            log.info("Value[" + tagName + "]: " + response.getObject(tagName));
                        }
                        // If it's more than one element, output each in a single row.
                        else {
                            log.info("Value[" + tagName + "]:");
                            for (int i = 0; i < numValues; i++) {
                                log.info(" - " + response.getObject(tagName, i));
                            }
                        }
                    }
                    // Something went wrong, to output an error message instead.
                    else {
                        log.error("Error[" + tagName + "]: " + response.getResponseCode(tagName).name());
                    }
                }
            }
            long end = System.currentTimeMillis();
            System.out.println(end - start);
            Thread.sleep(50);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}`

After a period of program execution, there may be a half package situation,

The complete response message should be '0103c8000100000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064a2ba', but the program cannot correctly parse the message due to two returns. Should length verification be added to the modbus return message. The error message is as follows `2024-02-22 09:41:33.469 WARN 19404 --- [ntLoopGroup-2-1] .p.j.s.GeneratedDriverByteToMessageCodec : Error decoding package with content [0103c8000100000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000]: Index 159 out of bounds for length 159

java.lang.ArrayIndexOutOfBoundsException: Index 159 out of bounds for length 159 at com.github.jinahya.bit.io.ArrayByteInput.read(ArrayByteInput.java:106) ~[bit-io-1.4.3.jar:na] at com.github.jinahya.bit.io.DefaultBitInput.read(DefaultBitInput.java:57) ~[bit-io-1.4.3.jar:na] at com.github.jinahya.bit.io.AbstractBitInput.unsigned8(AbstractBitInput.java:63) ~[bit-io-1.4.3.jar:na] at com.github.jinahya.bit.io.AbstractBitInput.unsigned16(AbstractBitInput.java:92) ~[bit-io-1.4.3.jar:na] at com.github.jinahya.bit.io.AbstractBitInput.readInt(AbstractBitInput.java:135) ~[bit-io-1.4.3.jar:na] at com.github.jinahya.bit.io.AbstractBitInput.readInt(AbstractBitInput.java:118) ~[bit-io-1.4.3.jar:na] at com.github.jinahya.bit.io.AbstractBitInput.readByte(AbstractBitInput.java:106) ~[bit-io-1.4.3.jar:na] at org.apache.plc4x.java.spi.generation.ReadBufferByteBased.readSignedByte(ReadBufferByteBased.java:388) ~[plc4j-spi-0.12.0.jar:0.12.0] at org.apache.plc4x.java.spi.generation.ReadBuffer.readByte(ReadBuffer.java:44) ~[plc4j-spi-0.12.0.jar:0.12.0] at org.apache.plc4x.java.spi.generation.ReadBufferByteBased.readByteArray(ReadBufferByteBased.java:126) ~[plc4j-spi-0.12.0.jar:0.12.0] at org.apache.plc4x.java.modbus.readwrite.ModbusPDUReadHoldingRegistersResponse.staticParseModbusPDUBuilder(ModbusPDUReadHoldingRegistersResponse.java:112) ~[plc4j-driver-modbus-0.12.0.jar:0.12.0] at org.apache.plc4x.java.modbus.readwrite.ModbusPDU.staticParse(ModbusPDU.java:181) ~[plc4j-driver-modbus-0.12.0.jar:0.12.0] at org.apache.plc4x.java.modbus.readwrite.ModbusRtuADU.lambda$0(ModbusRtuADU.java:132) ~[plc4j-driver-modbus-0.12.0.jar:0.12.0] at org.apache.plc4x.java.spi.codegen.io.DataReaderComplexDefault.read(DataReaderComplexDefault.java:70) ~[plc4j-spi-0.12.0.jar:0.12.0] at org.apache.plc4x.java.spi.codegen.io.DataReaderComplexDefault.read(DataReaderComplexDefault.java:61) ~[plc4j-spi-0.12.0.jar:0.12.0] at org.apache.plc4x.java.spi.codegen.fields.FieldReaderSimple.lambda$0(FieldReaderSimple.java:34) ~[plc4j-spi-0.12.0.jar:0.12.0] at org.apache.plc4x.java.spi.codegen.FieldCommons.switchParseByteOrderIfNecessary(FieldCommons.java:52) ~[plc4j-spi-0.12.0.jar:0.12.0] at org.apache.plc4x.java.spi.codegen.fields.FieldReaderSimple.readSimpleField(FieldReaderSimple.java:34) ~[plc4j-spi-0.12.0.jar:0.12.0] at org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.readSimpleField(FieldReaderFactory.java:133) ~[plc4j-spi-0.12.0.jar:0.12.0] at org.apache.plc4x.java.modbus.readwrite.ModbusRtuADU.staticParseModbusADUBuilder(ModbusRtuADU.java:129) ~[plc4j-driver-modbus-0.12.0.jar:0.12.0] at org.apache.plc4x.java.modbus.readwrite.ModbusADU.staticParse(ModbusADU.java:117) ~[plc4j-driver-modbus-0.12.0.jar:0.12.0] at org.apache.plc4x.java.modbus.readwrite.ModbusADU.staticParse(ModbusADU.java:103) ~[plc4j-driver-modbus-0.12.0.jar:0.12.0] at org.apache.plc4x.java.modbus.rtu.ModbusRtuDriver.lambda$0(ModbusRtuDriver.java:130) ~[plc4j-driver-modbus-0.12.0.jar:0.12.0] at org.apache.plc4x.java.spi.GeneratedDriverByteToMessageCodec.decode(GeneratedDriverByteToMessageCodec.java:87) ~[plc4j-spi-0.12.0.jar:0.12.0] at io.netty.handler.codec.ByteToMessageCodec$1.decode(ByteToMessageCodec.java:42) ~[netty-codec-4.1.94.Final.jar:4.1.94.Final] at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529) ~[netty-codec-4.1.94.Final.jar:4.1.94.Final] at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468) ~[netty-codec-4.1.94.Final.jar:4.1.94.Final] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290) ~[netty-codec-4.1.94.Final.jar:4.1.94.Final] at io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103) ~[netty-codec-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at org.apache.plc4x.java.transport.serial.SerialChannel$SerialNioUnsafe.read(SerialChannel.java:285) ~[plc4j-transport-serial-0.12.0.jar:0.12.0] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:689) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:652) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.94.Final.jar:4.1.94.Final] at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.94.Final.jar:4.1.94.Final] at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.94.Final.jar:4.1.94.Final] at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]

2024-02-22 09:41:33.471 WARN 19404 --- [ntLoopGroup-2-1] .p.j.s.GeneratedDriverByteToMessageCodec : Error decoding package with content [0000000000000000000000000000000000000000000000000000000000000000000000000000000000000064a2ba]: 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:310) ~[plc4j-driver-modbus-0.12.0.jar:0.12.0] at org.apache.plc4x.java.modbus.readwrite.ModbusRtuADU.lambda$0(ModbusRtuADU.java:132) ~[plc4j-driver-modbus-0.12.0.jar:0.12.0] at org.apache.plc4x.java.spi.codegen.io.DataReaderComplexDefault.read(DataReaderComplexDefault.java:70) ~[plc4j-spi-0.12.0.jar:0.12.0] at org.apache.plc4x.java.spi.codegen.io.DataReaderComplexDefault.read(DataReaderComplexDefault.java:61) ~[plc4j-spi-0.12.0.jar:0.12.0] at org.apache.plc4x.java.spi.codegen.fields.FieldReaderSimple.lambda$0(FieldReaderSimple.java:34) ~[plc4j-spi-0.12.0.jar:0.12.0] at org.apache.plc4x.java.spi.codegen.FieldCommons.switchParseByteOrderIfNecessary(FieldCommons.java:52) ~[plc4j-spi-0.12.0.jar:0.12.0] at org.apache.plc4x.java.spi.codegen.fields.FieldReaderSimple.readSimpleField(FieldReaderSimple.java:34) ~[plc4j-spi-0.12.0.jar:0.12.0] at org.apache.plc4x.java.spi.codegen.fields.FieldReaderFactory.readSimpleField(FieldReaderFactory.java:133) ~[plc4j-spi-0.12.0.jar:0.12.0] at org.apache.plc4x.java.modbus.readwrite.ModbusRtuADU.staticParseModbusADUBuilder(ModbusRtuADU.java:129) ~[plc4j-driver-modbus-0.12.0.jar:0.12.0] at org.apache.plc4x.java.modbus.readwrite.ModbusADU.staticParse(ModbusADU.java:117) ~[plc4j-driver-modbus-0.12.0.jar:0.12.0] at org.apache.plc4x.java.modbus.readwrite.ModbusADU.staticParse(ModbusADU.java:103) ~[plc4j-driver-modbus-0.12.0.jar:0.12.0] at org.apache.plc4x.java.modbus.rtu.ModbusRtuDriver.lambda$0(ModbusRtuDriver.java:130) ~[plc4j-driver-modbus-0.12.0.jar:0.12.0] at org.apache.plc4x.java.spi.GeneratedDriverByteToMessageCodec.decode(GeneratedDriverByteToMessageCodec.java:87) ~[plc4j-spi-0.12.0.jar:0.12.0] at io.netty.handler.codec.ByteToMessageCodec$1.decode(ByteToMessageCodec.java:42) ~[netty-codec-4.1.94.Final.jar:4.1.94.Final] at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529) ~[netty-codec-4.1.94.Final.jar:4.1.94.Final] at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468) ~[netty-codec-4.1.94.Final.jar:4.1.94.Final] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290) ~[netty-codec-4.1.94.Final.jar:4.1.94.Final] at io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103) ~[netty-codec-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at org.apache.plc4x.java.transport.serial.SerialChannel$SerialNioUnsafe.read(SerialChannel.java:285) ~[plc4j-transport-serial-0.12.0.jar:0.12.0] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:689) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:652) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) ~[netty-transport-4.1.94.Final.jar:4.1.94.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.94.Final.jar:4.1.94.Final] at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.94.Final.jar:4.1.94.Final] at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.94.Final.jar:4.1.94.Final] at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]`

StrawberryBlue avatar Feb 22 '24 01:02 StrawberryBlue

Currently at a conference... Will look into this as soon as I'm back home. And yeah... The serial transport is not included per default. We should probably change that to include all supported transports for a given driver.

chrisdutz avatar Feb 22 '24 07:02 chrisdutz

Can you reproduce this problem

StrawberryBlue avatar Feb 28 '24 02:02 StrawberryBlue

Modbus with serial functioning is broken in 0.12.0.

wenhuancui avatar May 27 '24 06:05 wenhuancui

@StrawberryBlue I just recently updated the Modbus driver to hopefully eliminate the half-packet problem ... could you please give that another try?

chrisdutz avatar May 27 '24 06:05 chrisdutz

it is fixed, great

StrawberryBlue avatar May 28 '24 02:05 StrawberryBlue