Re: Plc4x connection reset by peer exception uncaught

2020-09-16 Thread Łukasz Dywicki
I can't say more than others, but based on my own experiences I can tell
you that some exceptions are swallowed by Netty or surrounding classes
resulting in dead connections.
When I was working on socketcan transport its initialization failures lead
to connections which were allowing writes but never actually emitted
anything to the wire.

Based on stack trace - are you using TCP? Is connection initialized
properly? Some devices could refuse more than one connection at the time.
Also as far I know generated drivers must register message kinds to be
initialized properly. Netty pipeline is then configured with plc4x codec
handler.

Best,
Łukasz

śr., 16 wrz 2020 o 18:23 Vladyslav Milutin  napisał(a):

> Hi Stefano,
>
> Driver designed for custom IoT devices, driver itself just overrides
> abstract methods like protocol(), canWrite(), canRead(),
> getConfiguration().  It's not doing any logic.
>
> I think PooledDriverManager can help, but will it check the connection
> itself, not just when the getConnection() method is called?
>
>
> On 16 Sep 2020, at 19:07, Stefano Bossi  wrote:
>
>  Hi Vladyslav,
>
> just because a I am a curious guy, why did you choose to build a custom
> driver?
>
> Do you need something special ?
>
> Regards,
> Stefano
>
> P.S. feel free to answer: it's not your business  As said is just a
> curiosity, anyone has the right to choose it's road.
>
>
>
> On 16/09/2020 17:54, Christofer Dutz wrote:
>
> Hi Vladyslav,
>
> oh ... a custom driver. In that case it will definitely be tricky to
> help you unless we can have a look at the code.
>
> Is this something you consider bringing into the PLC4X project, or
> something that's meant to stay outside of the project?
>
> I guess this is the first time such a question has come up ;-)
>
> With integrations, I was referring to: Camel, Kafka, Edgent, NiFi, ...
> integrations that the PLC4X provides. But I guess you answered the
> question and you're not using any of them.
>
> The connection pool does a little more. Before returning a connection
> it checks if it's still alive and if it's not, it creates a new one.
>
> Chris
>
>
>
> Am 16.09.20, 17:39 schrieb "Vladyslav Milutin" 
> :
>
> Hi Christofer,
>
> Thanks for your quick response.
> I'm using a custom driver which extends GeneratedDriverBase, for
> connection
> I use a simple call to .connect, I know that you have
> PooledDriverManager,
> but it won't have the same issue if connection was reset by peer, since
> it's just look up for the specific connection?
> As
> integrations: plc4j-transport-tcp, plc4j-api, plc4j-spi,
> plc4j-connection-pool
> and other code generation and build utils. Or by integration you mean
> frameworks? If yes, Spring Frameworks.
>
> Kind regards,
> Vlad
>
> ср, 16 сент. 2020 г. в 17:28, Christofer Dutz
>  :
>
> > Hi Vladyslav,
> >
> > could you please tell us which driver and which version you are
> using?
> > Also it would be interesting if you are using any integration
> modules?
> >
> > Chris
> >
> > Am 16.09.20, 14:36 schrieb "Vladyslav Milutin"
>  :
> >
> > Hello guys,
> >
> > I'm writing to you with a hope that you can help me with
> exception
> > handling.
> > Currently after a long time connection can be reset by peer. See
> > stacktrace
> > below.
> >
> > I've tried to add a custom ChannelHandler which Overrides
> > exceptionCaught()
> > and add it in Driver#initializePipeline() see code below. Also
> has
> > tried to
> > add a channel that can be obtained from
> DefaultNettyPlcConnection. And
> > none
> > of them actualy was added to the pipeline where this exception
> was
> > thrown.
> >
> > plc4x version: 0.7.0
> >
> > StatckTrace:
> > 2020-09-16 13:50:03.340 WARN  [nioEventLoopGroup-58-1]
> > [io.netty.channel.DefaultChannelPipeline]
> onUnhandledInboundException
> > - An
> > exceptionCaught() event was fired, and it reached at the tail of
> the
> > pipeline. It usually means the last handler in the pipeline did
> not
> > handle
> > the exception.
> > java.io.IOException: Connection reset by peer
> >   at java.base/sun.nio.ch.FileDispatcherImpl.read0(Native
> Method)
> >   at java.base/sun.nio.ch
> > .SocketDispatcher.read(SocketDispatcher.java:39)
> >   at
> java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
> >   at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:233)
> >   at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:223)
> >   at java.base/sun.nio.ch
> > .SocketChannelImpl.read(SocketChannelImpl.java:358)
> >   at
> io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:253)
> >   at
> > io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1133)
> >   at
> >
> >

Re: Plc4x connection reset by peer exception uncaught

2020-09-16 Thread Stefano Bossi
Hi Vladyslav,

just because a I am a curious guy, why did you choose to build a custom
driver?

Do you need something special ?

Regards,
Stefano

P.S. feel free to answer: it's not your business  As said is just a
curiosity, anyone has the right to choose it's road.



On 16/09/2020 17:54, Christofer Dutz wrote:
> Hi Vladyslav,
>
> oh ... a custom driver. In that case it will definitely be tricky to help you 
> unless we can have a look at the code.
>
> Is this something you consider bringing into the PLC4X project, or something 
> that's meant to stay outside of the project?
>
> I guess this is the first time such a question has come up ;-)
>
> With integrations, I was referring to: Camel, Kafka, Edgent, NiFi, ... 
> integrations that the PLC4X provides. But I guess you answered the question 
> and you're not using any of them.
>
> The connection pool does a little more. Before returning a connection it 
> checks if it's still alive and if it's not, it creates a new one. 
>
> Chris
>
>
>
> Am 16.09.20, 17:39 schrieb "Vladyslav Milutin" :
>
> Hi Christofer,
>
> Thanks for your quick response.
> I'm using a custom driver which extends GeneratedDriverBase, for 
> connection
> I use a simple call to .connect, I know that you have PooledDriverManager,
> but it won't have the same issue if connection was reset by peer, since
> it's just look up for the specific connection?
> As
> integrations: plc4j-transport-tcp, plc4j-api, plc4j-spi, 
> plc4j-connection-pool
> and other code generation and build utils. Or by integration you mean
> frameworks? If yes, Spring Frameworks.
>
> Kind regards,
> Vlad
>
> ср, 16 сент. 2020 г. в 17:28, Christofer Dutz :
>
> > Hi Vladyslav,
> >
> > could you please tell us which driver and which version you are using?
> > Also it would be interesting if you are using any integration modules?
> >
> > Chris
> >
> > Am 16.09.20, 14:36 schrieb "Vladyslav Milutin" :
> >
> > Hello guys,
> >
> > I'm writing to you with a hope that you can help me with exception
> > handling.
> > Currently after a long time connection can be reset by peer. See
> > stacktrace
> > below.
> >
> > I've tried to add a custom ChannelHandler which Overrides
> > exceptionCaught()
> > and add it in Driver#initializePipeline() see code below. Also has
> > tried to
> > add a channel that can be obtained from DefaultNettyPlcConnection. 
> And
> > none
> > of them actualy was added to the pipeline where this exception was
> > thrown.
> >
> > plc4x version: 0.7.0
> >
> > StatckTrace:
> > 2020-09-16 13:50:03.340 WARN  [nioEventLoopGroup-58-1]
> > [io.netty.channel.DefaultChannelPipeline] 
> onUnhandledInboundException
> > - An
> > exceptionCaught() event was fired, and it reached at the tail of the
> > pipeline. It usually means the last handler in the pipeline did not
> > handle
> > the exception.
> > java.io.IOException: Connection reset by peer
> >   at java.base/sun.nio.ch.FileDispatcherImpl.read0(Native Method)
> >   at java.base/sun.nio.ch
> > .SocketDispatcher.read(SocketDispatcher.java:39)
> >   at 
> java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
> >   at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:233)
> >   at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:223)
> >   at java.base/sun.nio.ch
> > .SocketChannelImpl.read(SocketChannelImpl.java:358)
> >   at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:253)
> >   at
> > io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1133)
> >   at
> >
> > 
> io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:350)
> >   at
> >
> > 
> io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
> >   at
> >
> > 
> io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
> >   at
> >
> > 
> io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
> >   at
> >
> > 
> io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
> >   at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
> >   at
> >
> > 
> io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
> >   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:834)
> >
> > Driver#initializePipeline:
> > try {
> 

Re: Plc4x connection reset by peer exception uncaught

2020-09-16 Thread Christofer Dutz
Hi Vladyslav,

oh ... a custom driver. In that case it will definitely be tricky to help you 
unless we can have a look at the code.

Is this something you consider bringing into the PLC4X project, or something 
that's meant to stay outside of the project?

I guess this is the first time such a question has come up ;-)

With integrations, I was referring to: Camel, Kafka, Edgent, NiFi, ... 
integrations that the PLC4X provides. But I guess you answered the question and 
you're not using any of them.

The connection pool does a little more. Before returning a connection it checks 
if it's still alive and if it's not, it creates a new one. 

Chris



Am 16.09.20, 17:39 schrieb "Vladyslav Milutin" :

Hi Christofer,

Thanks for your quick response.
I'm using a custom driver which extends GeneratedDriverBase, for connection
I use a simple call to .connect, I know that you have PooledDriverManager,
but it won't have the same issue if connection was reset by peer, since
it's just look up for the specific connection?
As
integrations: plc4j-transport-tcp, plc4j-api, plc4j-spi, 
plc4j-connection-pool
and other code generation and build utils. Or by integration you mean
frameworks? If yes, Spring Frameworks.

Kind regards,
Vlad

ср, 16 сент. 2020 г. в 17:28, Christofer Dutz :

> Hi Vladyslav,
>
> could you please tell us which driver and which version you are using?
> Also it would be interesting if you are using any integration modules?
>
> Chris
>
> Am 16.09.20, 14:36 schrieb "Vladyslav Milutin" :
>
> Hello guys,
>
> I'm writing to you with a hope that you can help me with exception
> handling.
> Currently after a long time connection can be reset by peer. See
> stacktrace
> below.
>
> I've tried to add a custom ChannelHandler which Overrides
> exceptionCaught()
> and add it in Driver#initializePipeline() see code below. Also has
> tried to
> add a channel that can be obtained from DefaultNettyPlcConnection. And
> none
> of them actualy was added to the pipeline where this exception was
> thrown.
>
> plc4x version: 0.7.0
>
> StatckTrace:
> 2020-09-16 13:50:03.340 WARN  [nioEventLoopGroup-58-1]
> [io.netty.channel.DefaultChannelPipeline] onUnhandledInboundException
> - An
> exceptionCaught() event was fired, and it reached at the tail of the
> pipeline. It usually means the last handler in the pipeline did not
> handle
> the exception.
> java.io.IOException: Connection reset by peer
>   at java.base/sun.nio.ch.FileDispatcherImpl.read0(Native Method)
>   at java.base/sun.nio.ch
> .SocketDispatcher.read(SocketDispatcher.java:39)
>   at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
>   at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:233)
>   at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:223)
>   at java.base/sun.nio.ch
> .SocketChannelImpl.read(SocketChannelImpl.java:358)
>   at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:253)
>   at
> io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1133)
>   at
>
> 
io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:350)
>   at
>
> 
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
>   at
>
> 
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
>   at
>
> 
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
>   at
>
> 
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
>   at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
>   at
>
> 
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
>   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:834)
>
> Driver#initializePipeline:
> try {
> final Channel channel =
> channelFactory.createChannel(this.handler);
> channelFactory.initializePipeline(channel.pipeline());
>
> } catch (PlcConnectionException e) {
> log.error("Failed to create channel");
> }
>
> ChannelHandler:
> @Override
> public void exceptionCaught(ChannelHandlerContext ctx, Throwable
> cause)
> {
> log.warn("ExceptionCaught in worker: ctx = [{}], cause = [{},
> {}],
  

Re: Plc4x connection reset by peer exception uncaught

2020-09-16 Thread Vladyslav Milutin
Hi Christofer,

Thanks for your quick response.
I'm using a custom driver which extends GeneratedDriverBase, for connection
I use a simple call to .connect, I know that you have PooledDriverManager,
but it won't have the same issue if connection was reset by peer, since
it's just look up for the specific connection?
As
integrations: plc4j-transport-tcp, plc4j-api, plc4j-spi, plc4j-connection-pool
and other code generation and build utils. Or by integration you mean
frameworks? If yes, Spring Frameworks.

Kind regards,
Vlad

ср, 16 сент. 2020 г. в 17:28, Christofer Dutz :

> Hi Vladyslav,
>
> could you please tell us which driver and which version you are using?
> Also it would be interesting if you are using any integration modules?
>
> Chris
>
> Am 16.09.20, 14:36 schrieb "Vladyslav Milutin" :
>
> Hello guys,
>
> I'm writing to you with a hope that you can help me with exception
> handling.
> Currently after a long time connection can be reset by peer. See
> stacktrace
> below.
>
> I've tried to add a custom ChannelHandler which Overrides
> exceptionCaught()
> and add it in Driver#initializePipeline() see code below. Also has
> tried to
> add a channel that can be obtained from DefaultNettyPlcConnection. And
> none
> of them actualy was added to the pipeline where this exception was
> thrown.
>
> plc4x version: 0.7.0
>
> StatckTrace:
> 2020-09-16 13:50:03.340 WARN  [nioEventLoopGroup-58-1]
> [io.netty.channel.DefaultChannelPipeline] onUnhandledInboundException
> - An
> exceptionCaught() event was fired, and it reached at the tail of the
> pipeline. It usually means the last handler in the pipeline did not
> handle
> the exception.
> java.io.IOException: Connection reset by peer
>   at java.base/sun.nio.ch.FileDispatcherImpl.read0(Native Method)
>   at java.base/sun.nio.ch
> .SocketDispatcher.read(SocketDispatcher.java:39)
>   at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
>   at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:233)
>   at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:223)
>   at java.base/sun.nio.ch
> .SocketChannelImpl.read(SocketChannelImpl.java:358)
>   at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:253)
>   at
> io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1133)
>   at
>
> io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:350)
>   at
>
> io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
>   at
>
> io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
>   at
>
> io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
>   at
>
> io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
>   at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
>   at
>
> io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
>   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:834)
>
> Driver#initializePipeline:
> try {
> final Channel channel =
> channelFactory.createChannel(this.handler);
> channelFactory.initializePipeline(channel.pipeline());
>
> } catch (PlcConnectionException e) {
> log.error("Failed to create channel");
> }
>
> ChannelHandler:
> @Override
> public void exceptionCaught(ChannelHandlerContext ctx, Throwable
> cause)
> {
> log.warn("ExceptionCaught in worker: ctx = [{}], cause = [{},
> {}],
> workerName = [{}]",
> ctx, cause.getClass(), cause.getMessage(), workerName);
> if (cause instanceof ConnectTimeoutException) {
> log.warn("ConnectionTimeout caught: workerName = [{}]",
> workerName);
> }
> if ((cause instanceof IOException) &&
> cause.getMessage().contains("Connection reset by peer")) {
> log.warn("Connection reset by peer caught: workerName =
> [{}]",
> workerName);
> } else {
> log.info("Unexpected exception caught: workerName = [{}]",
> workerName);
> }
>
> this.callback.accept(cause);
> }
>
> DefaultNettyPlcConnection#channel:
> log.info("Trying to get connection channel: worker name = [{}]",
> this.workerName);
> final Channel channel = ((DefaultNettyPlcConnection)
> this.connection).getChannel();
> log.info("Channel obtained successfully. Adding custom
> channelHandler to it: channel = [{}], workerName = [{}]", channel,
> this.workerName);
> 

AW: Problems with Read/Write using PLC4J OPC UA driver

2020-09-16 Thread Gregor Minuge
Hi Milan,

thanks for the quick reply.

Of course I can show you my example code - I basically just modified Julian's 
code from https://github.com/pragmaticindustries/webinar-plc4x to try the 
read/write functionality of all data types present in the Eclipse Milo Server.
I hope the formatting of the mail doesn't look as awful again, my apologies if 
it does.

Best regards
Gregor Minuge


public class OpcDemo
{

   private static final Logger logger = LoggerFactory.getLogger( OpcDemo.class 
);

   public static void main( String[] args )
   {
  PlcDriverManager driverManager = new PlcDriverManager();

  try (PlcConnection connection = driverManager.getConnection( 
"opcua:tcp://127.0.0.1:12686/milo" ))
  {

 logger.info( "Verbindung ist aufgebaut..." );
 if( !connection.getMetadata().canWrite() )
 {
logger.error( "This connection doesn't support writing." );
return;
 }
 
 
 Boolean[] booleanArray = {true, true, true, true, true};

 CompletableFuture requestWriteFuture = 
connection.writeRequestBuilder()
  .addItem( "Boolean", "ns=2;s=HelloWorld/ScalarTypes/Boolean", 
true ) // WORKS
  .addItem( "Double", "ns=2;s=HelloWorld/ScalarTypes/Double", 
3.15 ) // WORKS
  .addItem( "Float", "ns=2;s=HelloWorld/ScalarTypes/Float", 
(float) 2.3 ) // WORKS   
  .addItem( "Int16", "ns=2;s=HelloWorld/ScalarTypes/Int16", 
(short) 15  ) // WORKS
  .addItem( "Int32", "ns=2;s=HelloWorld/ScalarTypes/Int32", 
64363 ) // WORKS
  .addItem( "Int64", "ns=2;s=HelloWorld/ScalarTypes/Int64", 
(long) 513 ) // WORKS
  .addItem( "Integer", "ns=2;s=HelloWorld/ScalarTypes/Integer", 
432 ) // WORKS
  .addItem( "SByte", "ns=2;s=HelloWorld/ScalarTypes/SByte", 
(byte) 2 ) // WORKS
  .addItem( "String", "ns=2;s=HelloWorld/ScalarTypes/String", 
"helloWorld" ) // WORKS
  .addItem( "StringWrite", 
"ns=2;s=HelloWorld/WriteOnly/String", "write" ) // WORKS

  //.addItem( "BooleanArray", 
"ns=2;s=HelloWorld/ArrayTypes/BooleanArray", true ) //ClassCastException
  //.addItem( "BooleanArray", 
"ns=2;s=HelloWorld/ArrayTypes/BooleanArray[0]", true ) 
//PlcInvalidFieldException
  //.addItem( "BooleanArray", 
"ns=2;s=HelloWorld/ArrayTypes/BooleanArray", booleanArray ) //ACCES DENIED

  //.addItem( "Bar", "ns=2;s=HelloWorld/MyObject/2:Bar", object 
) //no field handler for class java.lang.Object found (but maybe my approach 
was too simple)
  //.addItem( "DateTime", 
"ns=2;s=HelloWorld/ScalarTypes/DateTime", Instant.now()) //no field handler 
found (I also tried it with localdatetime and milliseconds)
  //.addItem( "Duration", 
"ns=2;s=HelloWorld/ScalarTypes/Duration", (long) 1 ) //ACCESS DENIED (was 
playing around with that, "real" duration leads to PlcInvalidFieldException 
iirc)
  //.addItem( "Guid", "ns=2;s=HelloWorld/ScalarTypes/Guid", 
UUID.randomUUID() ) //NO FIELD HANDLER FOUND
  //.addItem( "LocalizedText", 
"ns=2;s=HelloWorld/ScalarTypes/LocalizedText", "localized" ) //ACCESS DENIED 
(probably needs some other format, but maybe not implemented?)
  //.addItem( "NodeId", "ns=2;s=HelloWorld/ScalarTypes/NodeId", 
"{ns=1234, id=abcde}" ) //ACCESS DENIED
  //.addItem( "QualifiedName", 
"ns=2;s=HelloWorld/ScalarTypes/QualifiedName", "{name=defg, 
namespaceIndex=1234}" ) //ACCESS DENIED (with or without braces)

  //.addItem( "UtcTime", 
"ns=2;s=HelloWorld/ScalarTypes/UtcTime", Instant.now() ) //NO FIELD HANDLER 
FOUND
  //.addItem( "Variant", 
"ns=2;s=HelloWorld/ScalarTypes/Variant", new Variant(32) ) //NO FIELD HANDLER 
FOUND
  //.addItem( "XmlElement", 
"ns=2;s=HelloWorld/ScalarTypes/XmlElement",new Variant(new 
XmlElement("hello")) ) //NO FIELD HANDLER FOUND


  .build().execute();
 logger.info( "Schreibanfrage gesendet..." );

 PlcWriteResponse writeResponse = requestWriteFuture.get();
 logger.info( "Antwort auf Schreibanfrage erhalten..." );

 //  Inspect response
 logger.info( "Antwort der Steuerung:" );
 for( String fieldName : writeResponse.getFieldNames() )
 {
logger.info( "{} - {}", fieldName, writeResponse.getResponseCode( 
fieldName ) );
if( writeResponse.getResponseCode( fieldName ) == 
PlcResponseCode.OK )
{
   logger.info( "{} - {}", fieldName, writeResponse.getField( 
fieldName ) );
}
 }

 // Send Read Request
 //
 // Everything except for arrays works fine
 
 CompletableFuture requestFuture = 
connection.readRequestBuilder()

Re: Plc4x connection reset by peer exception uncaught

2020-09-16 Thread Stefano Bossi
Hi,

an another suggestion is to give a try to the pooled drive manager
instead of the simple dirve manager, here you could fine some more info:
https://plc4x.apache.org/users/tools/connection-pool.html

Regards,
Stefano


On 16/09/2020 16:30, Stefano Bossi wrote:
> Hi Vlad,
>
> this seems similar to a bug fixed some time ago, I am not really sure
> but it worth to try to use the 0.8.0 version where this fix is present.
>
> You should try to build the version and here you could fine some help:
> https://plc4x.apache.org/developers/index.html
>
> Regards,
> Stefano
>
> On 16/09/2020 14:32, Vladyslav Milutin wrote:
>> Hello guys,
>>
>> I'm writing to you with a hope that you can help me with exception
>> handling.
>> Currently after a long time connection can be reset by peer. See stacktrace
>> below.
>>
>> I've tried to add a custom ChannelHandler which Overrides exceptionCaught()
>> and add it in Driver#initializePipeline() see code below. Also has tried to
>> add a channel that can be obtained from DefaultNettyPlcConnection. And none
>> of them actualy was added to the pipeline where this exception was thrown.
>>
>> plc4x version: 0.7.0
>>
>> StatckTrace:
>> 2020-09-16 13:50:03.340 WARN  [nioEventLoopGroup-58-1]
>> [io.netty.channel.DefaultChannelPipeline] onUnhandledInboundException - An
>> exceptionCaught() event was fired, and it reached at the tail of the
>> pipeline. It usually means the last handler in the pipeline did not handle
>> the exception.
>> java.io.IOException: Connection reset by peer
>>   at java.base/sun.nio.ch.FileDispatcherImpl.read0(Native Method)
>>   at java.base/sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
>>   at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
>>   at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:233)
>>   at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:223)
>>   at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:358)
>>   at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:253)
>>   at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1133)
>>   at
>> io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:350)
>>   at
>> io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
>>   at
>> io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
>>   at
>> io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
>>   at
>> io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
>>   at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
>>   at
>> io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
>>   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:834)
>>
>> Driver#initializePipeline:
>> try {
>> final Channel channel =
>> channelFactory.createChannel(this.handler);
>> channelFactory.initializePipeline(channel.pipeline());
>>
>> } catch (PlcConnectionException e) {
>> log.error("Failed to create channel");
>> }
>>
>> ChannelHandler:
>> @Override
>> public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
>> {
>> log.warn("ExceptionCaught in worker: ctx = [{}], cause = [{}, {}],
>> workerName = [{}]",
>> ctx, cause.getClass(), cause.getMessage(), workerName);
>> if (cause instanceof ConnectTimeoutException) {
>> log.warn("ConnectionTimeout caught: workerName = [{}]",
>> workerName);
>> }
>> if ((cause instanceof IOException) &&
>> cause.getMessage().contains("Connection reset by peer")) {
>> log.warn("Connection reset by peer caught: workerName = [{}]",
>> workerName);
>> } else {
>> log.info("Unexpected exception caught: workerName = [{}]",
>> workerName);
>> }
>>
>> this.callback.accept(cause);
>> }
>>
>> DefaultNettyPlcConnection#channel:
>> log.info("Trying to get connection channel: worker name = [{}]",
>> this.workerName);
>> final Channel channel = ((DefaultNettyPlcConnection)
>> this.connection).getChannel();
>> log.info("Channel obtained successfully. Adding custom
>> channelHandler to it: channel = [{}], workerName = [{}]", channel,
>> this.workerName);
>> channel.pipeline().addLast(this.channelHandler);
>> log.info("ChannelHandler added: channel = [{}], channelHandler =
>> [{}], workerName = [{}]", channel, this.channelHandler, this.workerName);
>>
>> Kind regards,
>> Vlad
>>
>



signature.asc
Description: OpenPGP digital signature


[BUILD-STABLE]: Job 'PLC4X/PLC4X/develop [develop] [75]'

2020-09-16 Thread Apache Jenkins Server
BUILD-STABLE: Job 'PLC4X/PLC4X/develop [develop] [75]':

Is back to normal.

Re: Plc4x connection reset by peer exception uncaught

2020-09-16 Thread Stefano Bossi
Hi Vlad,

this seems similar to a bug fixed some time ago, I am not really sure
but it worth to try to use the 0.8.0 version where this fix is present.

You should try to build the version and here you could fine some help:
https://plc4x.apache.org/developers/index.html

Regards,
Stefano

On 16/09/2020 14:32, Vladyslav Milutin wrote:
> Hello guys,
>
> I'm writing to you with a hope that you can help me with exception
> handling.
> Currently after a long time connection can be reset by peer. See stacktrace
> below.
>
> I've tried to add a custom ChannelHandler which Overrides exceptionCaught()
> and add it in Driver#initializePipeline() see code below. Also has tried to
> add a channel that can be obtained from DefaultNettyPlcConnection. And none
> of them actualy was added to the pipeline where this exception was thrown.
>
> plc4x version: 0.7.0
>
> StatckTrace:
> 2020-09-16 13:50:03.340 WARN  [nioEventLoopGroup-58-1]
> [io.netty.channel.DefaultChannelPipeline] onUnhandledInboundException - An
> exceptionCaught() event was fired, and it reached at the tail of the
> pipeline. It usually means the last handler in the pipeline did not handle
> the exception.
> java.io.IOException: Connection reset by peer
>   at java.base/sun.nio.ch.FileDispatcherImpl.read0(Native Method)
>   at java.base/sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
>   at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
>   at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:233)
>   at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:223)
>   at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:358)
>   at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:253)
>   at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1133)
>   at
> io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:350)
>   at
> io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
>   at
> io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
>   at
> io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
>   at
> io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
>   at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
>   at
> io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
>   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:834)
>
> Driver#initializePipeline:
> try {
> final Channel channel =
> channelFactory.createChannel(this.handler);
> channelFactory.initializePipeline(channel.pipeline());
>
> } catch (PlcConnectionException e) {
> log.error("Failed to create channel");
> }
>
> ChannelHandler:
> @Override
> public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
> {
> log.warn("ExceptionCaught in worker: ctx = [{}], cause = [{}, {}],
> workerName = [{}]",
> ctx, cause.getClass(), cause.getMessage(), workerName);
> if (cause instanceof ConnectTimeoutException) {
> log.warn("ConnectionTimeout caught: workerName = [{}]",
> workerName);
> }
> if ((cause instanceof IOException) &&
> cause.getMessage().contains("Connection reset by peer")) {
> log.warn("Connection reset by peer caught: workerName = [{}]",
> workerName);
> } else {
> log.info("Unexpected exception caught: workerName = [{}]",
> workerName);
> }
>
> this.callback.accept(cause);
> }
>
> DefaultNettyPlcConnection#channel:
> log.info("Trying to get connection channel: worker name = [{}]",
> this.workerName);
> final Channel channel = ((DefaultNettyPlcConnection)
> this.connection).getChannel();
> log.info("Channel obtained successfully. Adding custom
> channelHandler to it: channel = [{}], workerName = [{}]", channel,
> this.workerName);
> channel.pipeline().addLast(this.channelHandler);
> log.info("ChannelHandler added: channel = [{}], channelHandler =
> [{}], workerName = [{}]", channel, this.channelHandler, this.workerName);
>
> Kind regards,
> Vlad
>



signature.asc
Description: OpenPGP digital signature


Re: Plc4x connection reset by peer exception uncaught

2020-09-16 Thread Christofer Dutz
Hi Vladyslav,

could you please tell us which driver and which version you are using? Also it 
would be interesting if you are using any integration modules?

Chris

Am 16.09.20, 14:36 schrieb "Vladyslav Milutin" :

Hello guys,

I'm writing to you with a hope that you can help me with exception
handling.
Currently after a long time connection can be reset by peer. See stacktrace
below.

I've tried to add a custom ChannelHandler which Overrides exceptionCaught()
and add it in Driver#initializePipeline() see code below. Also has tried to
add a channel that can be obtained from DefaultNettyPlcConnection. And none
of them actualy was added to the pipeline where this exception was thrown.

plc4x version: 0.7.0

StatckTrace:
2020-09-16 13:50:03.340 WARN  [nioEventLoopGroup-58-1]
[io.netty.channel.DefaultChannelPipeline] onUnhandledInboundException - An
exceptionCaught() event was fired, and it reached at the tail of the
pipeline. It usually means the last handler in the pipeline did not handle
the exception.
java.io.IOException: Connection reset by peer
  at java.base/sun.nio.ch.FileDispatcherImpl.read0(Native Method)
  at java.base/sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
  at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
  at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:233)
  at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:223)
  at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:358)
  at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:253)
  at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1133)
  at

io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:350)
  at

io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
  at
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
  at

io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
  at
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
  at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
  at

io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
  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:834)

Driver#initializePipeline:
try {
final Channel channel =
channelFactory.createChannel(this.handler);
channelFactory.initializePipeline(channel.pipeline());

} catch (PlcConnectionException e) {
log.error("Failed to create channel");
}

ChannelHandler:
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
{
log.warn("ExceptionCaught in worker: ctx = [{}], cause = [{}, {}],
workerName = [{}]",
ctx, cause.getClass(), cause.getMessage(), workerName);
if (cause instanceof ConnectTimeoutException) {
log.warn("ConnectionTimeout caught: workerName = [{}]",
workerName);
}
if ((cause instanceof IOException) &&
cause.getMessage().contains("Connection reset by peer")) {
log.warn("Connection reset by peer caught: workerName = [{}]",
workerName);
} else {
log.info("Unexpected exception caught: workerName = [{}]",
workerName);
}

this.callback.accept(cause);
}

DefaultNettyPlcConnection#channel:
log.info("Trying to get connection channel: worker name = [{}]",
this.workerName);
final Channel channel = ((DefaultNettyPlcConnection)
this.connection).getChannel();
log.info("Channel obtained successfully. Adding custom
channelHandler to it: channel = [{}], workerName = [{}]", channel,
this.workerName);
channel.pipeline().addLast(this.channelHandler);
log.info("ChannelHandler added: channel = [{}], channelHandler =
[{}], workerName = [{}]", channel, this.channelHandler, this.workerName);

Kind regards,
Vlad



AW: Problems with Read/Write using PLC4J OPC UA driver

2020-09-16 Thread Strljic, Matthias Milan
Hi Gregor,

i will look for your issue to write/read the basic types and arrays. At the 
moment the support for custom/dynamic types is not included into the OPC UA 
integration. If you could provide me there some example code, we could try to 
find there a solution for or at least the information if it is intentionally 
not included 

Greetings Matthias
Matthias Strljic, M.Sc.

Universität Stuttgart
Institut für Steuerungstechnik der Werkzeugmaschinen und 
Fertigungseinrichtungen (ISW)

Seidenstraße 36
70174 Stuttgart
GERMANY

Tel: +49 711 685-84530
Fax: +49 711 685-74530

E-Mail: matthias.strl...@isw.uni-stuttgart.de
Web: http://www.isw.uni-stuttgart.de

-Ursprüngliche Nachricht-
Von: Gregor Minuge  
Gesendet: Tuesday, September 15, 2020 2:20 PM
An: dev@plc4x.apache.org
Betreff: Problems with Read/Write using PLC4J OPC UA driver

Hi everyone,
I have two questions regarding the PLC4J OPC UA driver. I am connecting to the 
Eclipse Milo Server using the standard syntax as described 
here.

  1.  I'm not able to read arrays (or their elements). All other data types 
work fine, but I don't understand how to add array fields as items to the 
readRequestBuilder. I'm either (obviously) getting a ClassCastException when 
I'm trying .additem(.../BooleanArray) or an PlcInvalidFieldException when 
trying to access a field of the array like addItem(...BooleanArray[0]).

The response.getObject(fieldName) call mentioned under the "Getting 
Started" section on 
the website is not helping, because compilation already fails before getting 
the response.

If the reading of arrays is already implemented, could you please point me in 
the right direction here?



  1.  Likewise, I'm not able to write all data types. Apart from unsigned 
types, I'm having problems with Array, CustomStructTypeVariable, 
CustomUnionTypeVariable, AnalogValue, Object, Byte, ByteString, DateTime, Guid, 
QualifiedName, SByte, UtcTime, Variant and XmlElement.

I'm either getting an AccessDenied-error, probably because I'm trying to write 
the wrong data type to a field (which is especially strange for Byte), or a 
"java.lang.IllegalArgumentException: no field handler for class ... found" 
exception.

I could provide my code if needed, but as I'm generally following the suggested 
path for writing a writeRequest/Response, and it is working fine for simpler 
file types, I'd like to know whether these other types are already supported by 
the PLC4J library or not.
Lastly, if these features are not implemented in PLC4J, are there any plans to 
do so in the future, or would you recommend using Eclipse Milo to a wider 
extent, even if that meant neglecting the PLC4X-API in part? If it is the 
former and it would be appreciated, we could imagine helping you in your 
efforts.
Thanks for your time!
Best regards
Gregor Minuge



Plc4x connection reset by peer exception uncaught

2020-09-16 Thread Vladyslav Milutin
Hello guys,

I'm writing to you with a hope that you can help me with exception
handling.
Currently after a long time connection can be reset by peer. See stacktrace
below.

I've tried to add a custom ChannelHandler which Overrides exceptionCaught()
and add it in Driver#initializePipeline() see code below. Also has tried to
add a channel that can be obtained from DefaultNettyPlcConnection. And none
of them actualy was added to the pipeline where this exception was thrown.

plc4x version: 0.7.0

StatckTrace:
2020-09-16 13:50:03.340 WARN  [nioEventLoopGroup-58-1]
[io.netty.channel.DefaultChannelPipeline] onUnhandledInboundException - An
exceptionCaught() event was fired, and it reached at the tail of the
pipeline. It usually means the last handler in the pipeline did not handle
the exception.
java.io.IOException: Connection reset by peer
  at java.base/sun.nio.ch.FileDispatcherImpl.read0(Native Method)
  at java.base/sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
  at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
  at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:233)
  at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:223)
  at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:358)
  at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:253)
  at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1133)
  at
io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:350)
  at
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
  at
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
  at
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
  at
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
  at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
  at
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
  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:834)

Driver#initializePipeline:
try {
final Channel channel =
channelFactory.createChannel(this.handler);
channelFactory.initializePipeline(channel.pipeline());

} catch (PlcConnectionException e) {
log.error("Failed to create channel");
}

ChannelHandler:
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
{
log.warn("ExceptionCaught in worker: ctx = [{}], cause = [{}, {}],
workerName = [{}]",
ctx, cause.getClass(), cause.getMessage(), workerName);
if (cause instanceof ConnectTimeoutException) {
log.warn("ConnectionTimeout caught: workerName = [{}]",
workerName);
}
if ((cause instanceof IOException) &&
cause.getMessage().contains("Connection reset by peer")) {
log.warn("Connection reset by peer caught: workerName = [{}]",
workerName);
} else {
log.info("Unexpected exception caught: workerName = [{}]",
workerName);
}

this.callback.accept(cause);
}

DefaultNettyPlcConnection#channel:
log.info("Trying to get connection channel: worker name = [{}]",
this.workerName);
final Channel channel = ((DefaultNettyPlcConnection)
this.connection).getChannel();
log.info("Channel obtained successfully. Adding custom
channelHandler to it: channel = [{}], workerName = [{}]", channel,
this.workerName);
channel.pipeline().addLast(this.channelHandler);
log.info("ChannelHandler added: channel = [{}], channelHandler =
[{}], workerName = [{}]", channel, this.channelHandler, this.workerName);

Kind regards,
Vlad


Connection reset by peer exception uncaught

2020-09-16 Thread Vladyslav Milutin
Hello guys,

I'm writing to you with a hope that you can help me with exception handling.
Currently after a long time connection can be reset by peer. See stacktrace
below.

I've tried to add a custom ChannelHandler which Overrides exceptionCaught()
and add it in Driver#initializePipeline() see code below. Also has tried to
add a channel that can be obtained from DefaultNettyPlcConnection. And none
of them actualy was added to the pipeline where this exception was thrown.

plc4x version: 0.7.0

StatckTrace:
2020-09-16 13:50:03.340 WARN  [nioEventLoopGroup-58-1]
[io.netty.channel.DefaultChannelPipeline] onUnhandledInboundException - An
exceptionCaught() event was fired, and it reached at the tail of the
pipeline. It usually means the last handler in the pipeline did not handle
the exception.
java.io.IOException: Connection reset by peer
  at java.base/sun.nio.ch.FileDispatcherImpl.read0(Native Method)
  at java.base/sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
  at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
  at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:233)
  at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:223)
  at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:358)
  at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:253)
  at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1133)
  at
io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:350)
  at
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
  at
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
  at
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
  at
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
  at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
  at
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
  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:834)

Driver#initializePipeline:
try {
final Channel channel =
channelFactory.createChannel(this.handler);
channelFactory.initializePipeline(channel.pipeline());

} catch (PlcConnectionException e) {
log.error("Failed to create channel");
}

ChannelHandler:
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
{
log.warn("ExceptionCaught in worker: ctx = [{}], cause = [{}, {}],
workerName = [{}]",
ctx, cause.getClass(), cause.getMessage(), workerName);
if (cause instanceof ConnectTimeoutException) {
log.warn("ConnectionTimeout caught: workerName = [{}]",
workerName);
}
if ((cause instanceof IOException) &&
cause.getMessage().contains("Connection reset by peer")) {
log.warn("Connection reset by peer caught: workerName = [{}]",
workerName);
} else {
log.info("Unexpected exception caught: workerName = [{}]",
workerName);
}

this.callback.accept(cause);
}

DefaultNettyPlcConnection#channel:
log.info("Trying to get connection channel: worker name = [{}]",
this.workerName);
final Channel channel = ((DefaultNettyPlcConnection)
this.connection).getChannel();
log.info("Channel obtained successfully. Adding custom
channelHandler to it: channel = [{}], workerName = [{}]", channel,
this.workerName);
channel.pipeline().addLast(this.channelHandler);
log.info("ChannelHandler added: channel = [{}], channelHandler =
[{}], workerName = [{}]", channel, this.channelHandler, this.workerName);

Kind regards,
Vlad


[BUILD-FAILURE]: Job 'PLC4X/PLC4X/develop [develop] [74]'

2020-09-16 Thread Apache Jenkins Server
BUILD-FAILURE: Job 'PLC4X/PLC4X/develop [develop] [74]':

Check console output at "https://ci-builds.apache.org/job/PLC4X/job/PLC4X/job/develop/74/;>PLC4X/PLC4X/develop
 [develop] [74]"

[BUILD-FAILURE]: Job 'PLC4X/PLC4X/develop [develop] [73]'

2020-09-16 Thread Apache Jenkins Server
BUILD-FAILURE: Job 'PLC4X/PLC4X/develop [develop] [73]':

Check console output at "https://ci-builds.apache.org/job/PLC4X/job/PLC4X/job/develop/73/;>PLC4X/PLC4X/develop
 [develop] [73]"