apache / plc4x

PLC4X The Industrial IoT adapter
https://plc4x.apache.org/
Apache License 2.0
1.24k stars 399 forks source link

[Bug]: The onError calls are always ignored #1726

Closed splatch closed 1 week ago

splatch commented 4 weeks ago

What happened?

Any send operation which expects response can specify criteria for matching answers but also error handlers which should be called when handling logic fails. Determination when error handler should be called is not trivial. Most of protocols have fairly long unwrap/check statements which can fail at any stage. We can not assume which stage will fail, we can't layer error handlers, thus we need carefully craft logic and make sure that we don't catch too much and still propagate failures to driver and clean up handlers. Currently it might be that packet consumers are retained until timeout, even if we know that they can't properly handle incoming data.

Version

v0.12

Programming Languages

Protocols

chrisdutz commented 3 weeks ago

I noticed while tracking down some issues in the EIP when connecting to my WAGO device, that also errors thrown in the handlers don't seem to arive at the user ... so I changed:

throw new PlcRuntimeException("The remote device doesn't seem to use " + configuration.getByteOrder().name() + " byte order.");

To:

context.getChannel().pipeline().fireExceptionCaught(new PlcRuntimeException("The remote device doesn't seem to use " + configuration.getByteOrder().name() + " byte order."));

And now I'm getting the errors, I was expecting to see.