kevinherron / ua-client-sdk

OPC-UA Client SDK for Java
27 stars 16 forks source link

UaTcpStackClient.getEndpoints fails to connect to opc ua server #9

Open tosuns opened 8 years ago

tosuns commented 8 years ago

I have an issue with my unit test trying to connect to an opcua server. But it only happens on my workstation. if I use my notebook I'm able to connect to the server and the test cases run successfully.

it seems like a network issue, but the strange thing is I'm able to connect to the opcua server from my workstation via another opcua client.

I get the following stack trace:

[main] DEBUG io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework [main] DEBUG io.netty.channel.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 32 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: true [main] DEBUG io.netty.util.internal.PlatformDependent - Platform: Windows [main] DEBUG io.netty.util.internal.PlatformDependent - Java version: 8 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noUnsafe: false [main] DEBUG io.netty.util.internal.PlatformDependent - sun.misc.Unsafe: available [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noJavassist: false [main] DEBUG io.netty.util.internal.PlatformDependent - Javassist: unavailable [main] DEBUG io.netty.util.internal.PlatformDependent - You don't have Javassist in your class path or you don't have enough permission to load dynamically generated classes. Please check the configuration for better performance. [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.tmpdir: C:\Users\SERDAR~1\AppData\Local\Temp (java.io.tmpdir) [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model) [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512 [main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.level: simple [main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.maxRecords: 4 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numHeapArenas: 28 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numDirectArenas: 28 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.pageSize: 8192 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxOrder: 11 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.chunkSize: 16777216 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.tinyCacheSize: 512 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.smallCacheSize: 256 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.normalCacheSize: 64 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedBufferCapacity: 32768 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimInterval: 8192 [main] DEBUG io.netty.util.internal.ThreadLocalRandom - -Dio.netty.initialSeedUniquifier: 0xba6bc87714931033 (took 2 ms) [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: unpooled [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.threadLocalDirectBufferSize: 65536 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.maxThreadLocalCharBufferSize: 16384 [ua-netty-event-loop-0] DEBUG io.netty.buffer.AbstractByteBuf - -Dio.netty.buffer.bytebuf.checkAccessible: true [ua-netty-event-loop-0] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxCapacity.default: 262144 [ua-netty-event-loop-0] DEBUG com.digitalpetri.opcua.stack.client.handlers.UaTcpClientAcknowledgeHandler - Sent Hello message on channel=[id: 0x076928f2, /192.168.178.49:53028 => /192.168.178.48:4840]. [ua-netty-event-loop-0] DEBUG com.digitalpetri.opcua.stack.client.handlers.UaTcpClientAcknowledgeHandler - Received Acknowledge message on channel=[id: 0x076928f2, /192.168.178.49:53028 => /192.168.178.48:4840]. [ua-netty-event-loop-0] DEBUG com.digitalpetri.opcua.stack.client.handlers.UaTcpClientMessageHandler - OpenSecureChannel timeout scheduled for +5s [ua-shared-pool-0] DEBUG com.digitalpetri.opcua.stack.client.handlers.UaTcpClientMessageHandler - Sent OpenSecureChannelRequest (Issue, id=0, currentToken=-1, previousToken=-1). [ua-netty-event-loop-0] DEBUG com.digitalpetri.opcua.stack.client.handlers.UaTcpClientMessageHandler - OpenSecureChannel timeout canceled [ua-shared-pool-0] ERROR com.digitalpetri.opcua.stack.client.handlers.UaTcpClientMessageHandler - Error decoding OpenSecureChannelResponse: no decoder registered for encodingId=NodeId{ns=0, id=449} com.digitalpetri.opcua.stack.core.UaSerializationException: no decoder registered for encodingId=NodeId{ns=0, id=449} at com.digitalpetri.opcua.stack.core.serialization.DelegateRegistry.getDecoder(DelegateRegistry.java:116) at com.digitalpetri.opcua.stack.core.serialization.binary.BinaryDecoder.decodeMessage(BinaryDecoder.java:367) at com.digitalpetri.opcua.stack.client.handlers.UaTcpClientMessageHandler.lambda$onOpenSecureChannel$15(UaTcpClientMessageHandler.java:414) at com.digitalpetri.opcua.stack.core.channel.SerializationQueue.lambda$decode$1(SerializationQueue.java:61) at com.digitalpetri.opcua.stack.core.util.ExecutionQueue$PollAndExecute.run(ExecutionQueue.java:110) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) [ForkJoinPool.commonPool-worker-9] DEBUG com.digitalpetri.opcua.stack.client.ClientChannelManager - Channel bootstrap failed: connection closed UaException: status=Bad_ConnectionClosed, message=connection closed at com.digitalpetri.opcua.stack.client.handlers.UaTcpClientMessageHandler.channelInactive(UaTcpClientMessageHandler.java:162) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:208) at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:194) at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:332) at io.netty.handler.codec.ByteToMessageCodec.channelInactive(ByteToMessageCodec.java:118) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:208) at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:194) at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:822) at io.netty.channel.AbstractChannel$AbstractUnsafe$7.run(AbstractChannel.java:666) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:358) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) at java.lang.Thread.run(Thread.java:745)

I'm running Java: java version "1.8.0_92" Java(TM) SE Runtime Environment (build 1.8.0_92-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)

I guess the initial cause for the exception is Error decoding OpenSecureChannelResponse: no decoder registered for encodingId=NodeId{ns=0, id=449}. The question is: why and how can I fix that ?

kevinherron commented 8 years ago

I've seen this before with other users, and in all cases there's been something wrong with their classloading setup, like running inside an OSGi container but things aren't quite lined up right, or having changed the package name.

If you look at the DelegateRegistry class you'll see it has a static initializer that loads all the classes up - it must be failing to load for you. Do you see any errors about that? Can you breakpoint and make sure it's loading?

kevinherron commented 8 years ago

Btw, project has moved: https://github.com/eclipse/milo

tosuns commented 8 years ago

Thanks for the pointer. Next time I will report the issue at the new repository.

Back to the issue. I change my dependencies to the milo jars and started my unit test again, but it still failed. It seems like in my unit test the OpenSecureChannelResponse class never gets loaded but the OpenSecureChannelRequest class does. I'm not sure why. I set the logging to trace, but could not find any exceptions regarding class loading.

The next thing I did was creating a singleton ejb and adding the following code to a method, which was annotated with @Postconstruct:

EndpointDescription[] endpoints = UaTcpStackClient.getEndpoints( "opc.tcp://192.168.178.48:4840").get();

I deployed the project and everything worked fine.

The exceptions I get in my unit test is the following. It is more or less the same like the previous one, but with trace loggings:

[main] DEBUG io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework [main] DEBUG io.netty.channel.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 32 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: true [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.DirectByteBuffer.<init>(long, int): available [main] DEBUG io.netty.util.internal.PlatformDependent - Platform: Windows [main] DEBUG io.netty.util.internal.PlatformDependent - Java version: 8 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noUnsafe: false [main] DEBUG io.netty.util.internal.PlatformDependent - sun.misc.Unsafe: available [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noJavassist: false [main] DEBUG io.netty.util.internal.PlatformDependent - Javassist: unavailable [main] DEBUG io.netty.util.internal.PlatformDependent - You don't have Javassist in your class path or you don't have enough permission to load dynamically generated classes. Please check the configuration for better performance. [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.tmpdir: C:\Users\SERDAR~1\AppData\Local\Temp (java.io.tmpdir) [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model) [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false [main] DEBUG io.netty.util.internal.PlatformDependent - io.netty.maxDirectMemory: 2861563904 bytes [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@18eed359 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@3e9b1010 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@6c3708b3 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@6f1fba17 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@185d8b6 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@67784306 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@335eadca [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@210366b4 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@eec5a4a [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@2b2948e2 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@6ddf90b0 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@57536d79 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@3b0143d3 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@5a8e6209 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@4b4523f8 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@731a74c [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@369f73a2 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@1f28c152 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@7d907bac [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@7791a895 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@3a5ed7a6 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@6325a3ee [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@1d16f93d [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@67b92f0a [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@2b9627bc [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@65e2dbf3 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@4f970963 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@61f8bee4 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@7b49cea0 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@887af79 [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@7fac631b [main] TRACE io.netty.channel.nio.NioEventLoop - Instrumented an optimized java.util.Set into: sun.nio.ch.WindowsSelectorImpl@5b87ed94 [main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.level: simple [main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.maxRecords: 4 [main] TRACE org.eclipse.milo.opcua.stack.client.ClientChannelManager - getChannel(), currentState=Idle [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numHeapArenas: 28 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numDirectArenas: 28 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.pageSize: 8192 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxOrder: 11 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.chunkSize: 16777216 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.tinyCacheSize: 512 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.smallCacheSize: 256 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.normalCacheSize: 64 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedBufferCapacity: 32768 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimInterval: 8192 [main] DEBUG io.netty.util.internal.ThreadLocalRandom - -Dio.netty.initialSeedUniquifier: 0xdaa640748ce891f2 (took 0 ms) [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: unpooled [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.threadLocalDirectBufferSize: 65536 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.maxThreadLocalCharBufferSize: 16384 [ua-netty-event-loop-0] DEBUG io.netty.buffer.AbstractByteBuf - -Dio.netty.buffer.bytebuf.checkAccessible: true [ua-netty-event-loop-0] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxCapacity.default: 262144 [ua-netty-event-loop-0] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.linkCapacity: 16 [ua-netty-event-loop-0] DEBUG org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientAcknowledgeHandler - Sent Hello message on channel=[id: 0xa1104be5, L:/192.168.178.49:63946 - R:/192.168.178.48:4840]. [ua-netty-event-loop-0] DEBUG org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientAcknowledgeHandler - Received Acknowledge message on channel=[id: 0xa1104be5, L:/192.168.178.49:63946 - R:/192.168.178.48:4840]. [ua-netty-event-loop-0] DEBUG org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientMessageHandler - OpenSecureChannel timeout scheduled for +5s [ua-shared-pool-0] DEBUG org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientMessageHandler - Sent OpenSecureChannelRequest (Issue, id=0, currentToken=-1, previousToken=-1). [ua-netty-event-loop-0] DEBUG org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientMessageHandler - OpenSecureChannel timeout canceled [ua-shared-pool-0] ERROR org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientMessageHandler - Error decoding OpenSecureChannelResponse: no decoder registered for encodingId=NodeId{ns=0, id=449} org.eclipse.milo.opcua.stack.core.UaSerializationException: no decoder registered for encodingId=NodeId{ns=0, id=449} at org.eclipse.milo.opcua.stack.core.serialization.DelegateRegistry.getDecoder(DelegateRegistry.java:113) at org.eclipse.milo.opcua.stack.core.serialization.binary.BinaryDecoder.decodeMessage(BinaryDecoder.java:364) at org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientMessageHandler.lambda$onOpenSecureChannel$15(UaTcpClientMessageHandler.java:411) at org.eclipse.milo.opcua.stack.core.channel.SerializationQueue.lambda$decode$1(SerializationQueue.java:58) at org.eclipse.milo.opcua.stack.core.util.ExecutionQueue$PollAndExecute.run(ExecutionQueue.java:107) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) [ForkJoinPool.commonPool-worker-9] DEBUG org.eclipse.milo.opcua.stack.client.ClientChannelManager - Channel bootstrap failed: connection closed UaException: status=Bad_ConnectionClosed, message=connection closed at org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientMessageHandler.channelInactive(UaTcpClientMessageHandler.java:159) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:233) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:219) at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:212) at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:360) at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:325) at io.netty.handler.codec.ByteToMessageCodec.channelInactive(ByteToMessageCodec.java:118) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:233) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:219) at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:212) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelInactive(DefaultChannelPipeline.java:1275) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:233) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:219) at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:872) at io.netty.channel.AbstractChannel$AbstractUnsafe$7.run(AbstractChannel.java:679) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:358) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:394) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) at java.lang.Thread.run(Thread.java:745) [ForkJoinPool.commonPool-worker-2] TRACE org.eclipse.milo.opcua.stack.client.ClientChannelManager - disconnect(), currentState=Idle

kevinherron commented 8 years ago

Is it possible you can wrap this up into a self-contained test case? I'm not really sure how to troubleshoot something like this and I've never seen it happen locally. It must be something environment-related, but I don't know what...

kevinherron commented 8 years ago

I also wonder if DelegateRegistry needs some locking...

kevinherron commented 8 years ago

Can you reproduce this reliably? I've got a branch going against https://github.com/eclipse/milo that adds some locking that may fix it. If you are willing to test it let me know.

tosuns commented 8 years ago

I doubt that I can wrap it around to a reliable test case, because the issue seems to be depending on my system environment. I already mentioned that the test case does not work on my workstation only. The test case executes successfully on my other machines.

I will check the new branch and see, whether the changes will fix the issue.

LV-LISPEN commented 8 years ago

Hello,

I've this problem with execution (Run As --> Eclipse Application) of my program (that uses some of my Eclipse plugins).

[ua-shared-pool-0] ERROR org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientMessageHandler - Error decoding OpenSecureChannelResponse: no decoder registered for encodingId=NodeId{ns=0, id=449}
org.eclipse.milo.opcua.stack.core.UaSerializationException: no decoder registered for encodingId=NodeId{ns=0, id=449}
    at org.eclipse.milo.opcua.stack.core.serialization.DelegateRegistry$Instance.getDecoder(DelegateRegistry.java:210)
    at org.eclipse.milo.opcua.stack.core.serialization.binary.BinaryDecoder.decodeMessage(BinaryDecoder.java:366)
    at org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientMessageHandler.lambda$6(UaTcpClientMessageHandler.java:411)
    at org.eclipse.milo.opcua.stack.core.channel.SerializationQueue.lambda$1(SerializationQueue.java:58)
    at org.eclipse.milo.opcua.stack.core.util.ExecutionQueue$PollAndExecute.run(ExecutionQueue.java:107)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
java.util.concurrent.ExecutionException: UaException: status=Bad_ConnectionClosed, message=connection closed
    at java.util.concurrent.CompletableFuture.reportGet(Unknown Source)
    at java.util.concurrent.CompletableFuture.get(Unknown Source)
    at org.my.package.communication.opcua.OpcUaClientRunner.createClient(OpcUaClientRunner.java:55)
    at org.my.package.communication.opcua.OpcUaClientRunner.run(OpcUaClientRunner.java:99)
    at java.lang.Thread.run(Unknown Source)
Caused by: UaException: status=Bad_ConnectionClosed, message=connection closed
    at org.eclipse.milo.opcua.stack.client.handlers.UaTcpClientMessageHandler.channelInactive(UaTcpClientMessageHandler.java:160)
    at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelInactiveNow(ChannelHandlerInvokerUtil.java:56)
    at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelInactive(DefaultChannelHandlerInvoker.java:93)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:342)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:124)
    at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:349)
    at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:309)
    at io.netty.handler.codec.ByteToMessageCodec.channelInactive(ByteToMessageCodec.java:118)
    at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelInactiveNow(ChannelHandlerInvokerUtil.java:56)
    at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelInactive(DefaultChannelHandlerInvoker.java:93)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:342)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:124)
    at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:1060)
    at io.netty.channel.AbstractChannel$AbstractUnsafe$7.run(AbstractChannel.java:733)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:339)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:356)
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:742)
    ... 1 more

My context in Eclipse Mars version : I've a plugin A that is used by a plugin B (A<-B). I've the plugin B that is used by my main program C (B<-C). At final : A<-B<-C.

I've execute a first time my program C with "Run as --> Java Application". Everything is working normally :-) I've execute a second time my program C with "Run as --> Eclipse Application". This is where I get the above error :-s

Any ideas ?

Thanks in advance !

LV-LISPEN commented 8 years ago

RESOLVED (see https://github.com/eclipse/milo/issues/39)

Thanks very well ! Now, it's working with success !