Detect OPC server failure

669 views
Skip to first unread message

Luca Segafredo

unread,
Jan 28, 2013, 4:55:56 AM1/28/13
to open...@googlegroups.com
Hi, I'm using UTGard with success except for the ability to detect whether the OPC server is currently running or not. I mean, we've got several Wonderware OPC servers and sometimes some of them simply crash, and despite having an org.openscada.opc.lib.daAutoReconnectController with a AutoReconnectListener registered, the crash is not detected by the library. I'd expect a AutoReconnectState to be fired when the DA server goes offline, but that's not what happens. The exceptions are only printed without being relaunched, how they should, in my opinion.
Maybe I'm only using the wrong methods and I should use other classes to handle my problems, if that's the case I'd really appreciate some help, otherwise I would  like to suggest changes in UTGard for the OPC failover handling.


This is the stacktrace of my program when at somepoint, during the executions I stop the OPC service. You can see the JInterop exceptions an the absence of the AutoReconnectState.DISCONNECTED feedback after them.


2013-01-28 10:30:34,894 [OPCReconnectThread]  INFO com.ste.monitor.client.SteMonitor$AutoReconnectListenerImpl :394 - Something changed on OPC connection state:CONNECTING
2013-01-28 10:30:35,185 [OPCReconnectThread]  INFO com.ste.monitor.client.SteMonitor :98 - OPC state changed:true
2013-01-28 10:30:35,185 [OPCReconnectThread]  INFO com.ste.monitor.client.SteMonitor$AutoReconnectListenerImpl :367 - Connected to OPC
gen 28, 2013 10:33:34 AM JISession Release_References_TimerTask:run()
Grave: Exception in internal GC
org.jinterop.dcom.common.JIException: An internal error occurred. [0x8001FFFF]
    at org.jinterop.dcom.core.JIRemUnknownServer.call(JIRemUnknownServer.java:158)
    at org.jinterop.dcom.core.JIRemUnknownServer.addRef_ReleaseRef(JIRemUnknownServer.java:181)
    at org.jinterop.dcom.core.JISession.releaseRefs(JISession.java:841)
    at org.jinterop.dcom.core.JISession.access$8(JISession.java:828)
    at org.jinterop.dcom.core.JISession$Release_References_TimerTask.run(JISession.java:288)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)
Caused by: java.io.IOException: Connessione in corso interrotta forzatamente dall'host remoto
    at sun.nio.ch.SocketDispatcher.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:89)
    at sun.nio.ch.IOUtil.write(IOUtil.java:60)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:450)
    at java.nio.channels.Channels.writeFullyImpl(Channels.java:78)
    at java.nio.channels.Channels.writeFully(Channels.java:98)
    at java.nio.channels.Channels.access$000(Channels.java:61)
    at java.nio.channels.Channels$1.write(Channels.java:174)
    at org.jinterop.dcom.transport.JIComTransport.send(JIComTransport.java:143)
    at rpc.DefaultConnection.transmitFragment(DefaultConnection.java:144)
    at rpc.DefaultConnection.transmit(DefaultConnection.java:78)
    at rpc.ConnectionOrientedEndpoint.send(ConnectionOrientedEndpoint.java:222)
    at rpc.ConnectionOrientedEndpoint.call(ConnectionOrientedEndpoint.java:112)
    at rpc.Stub.call(Stub.java:113)
    at org.jinterop.dcom.core.JIRemUnknownServer.call(JIRemUnknownServer.java:152)
    ... 6 more

Luca Segafredo

unread,
Jan 28, 2013, 5:42:10 AM1/28/13
to open...@googlegroups.com
Ok, I found out a workaround. I have a scheduled task that every n seconds call the getStatus method of the org.openscada.opc.dcom.da.impl.OPCServer class.

Jens Reimann

unread,
Jan 29, 2013, 3:00:42 PM1/29/13
to open...@googlegroups.com

Hello,

Sorry for the late reply.

Well, that is what I would have suggested anyway ;-) and this is also what the openSCADA OPC server, which is using utgard, does. In the org.openscada. da.server.opc package of the Atlantis project you can find the opccontroller which shows the "main loop" we are using for OPC communication. This has proven to be quite reliable.

Best regards

Jens Reimann

--
 
 

Walter Peirone

unread,
Jun 18, 2013, 11:52:35 AM6/18/13
to open...@googlegroups.com
Hi,

Anyone know about how to use openscada opc (not just utgard)  to access OPC servers ?
How should be the openscada way, I mean how to configure the connection, how to request the items, etc.

thanks in advance,
Walter

CptMauli

unread,
Jun 18, 2013, 11:53:18 PM6/18/13
to open...@googlegroups.com

That is actually the next step we are going to document. The problem with the openSCADA drivers until the current 1.2 branch is, that the configuration for the OPC driver is based on XML Beans, which is regarding class loading a pita. This is fine for us, since we know how to set it up, but for others it is complicated to explain. In the current 1.2 branch we replaced it with a EMF based variant. Since we knew this replacement would come we hesitated to document the old way.

Now in the 1.2 branch we also have an Eclipse plugin which makes starting a driver within the IDE pretty painless. This we will explain how to do in the next part of the tutorial, which we will post in the next few weeks.


best regards
Jürgen

Walter Peirone

unread,
Jun 19, 2013, 9:02:32 AM6/19/13
to open...@googlegroups.com
Thank you for your response Jürgen.
I think xml beans could be fine for me, because what I wanted to do.  I have tried with openSCADA 1.1 version in an osgi application that I already have, I was trying to add opc access functionality. I just wanted to use the controller, but i didn´t figured out how to call it from the code I already have. I´m not sure if I could reference it as a service and/or how to give it the xml with the conf.

I´ll be waiting for the doc. By the way, great job with the doc about how to use Utgard.

best regards,
Walter

CptMauli

unread,
Jun 20, 2013, 10:12:29 AM6/20/13
to open...@googlegroups.com
Thanks for the praise, maybe the best way to find out how the xml beans stuff is set up if you dig into either the debian files (on our apt repositotry http://apt.openscada.org/), or the Windows driver setup http://download.openscada.org/installer/driverPackage/R/

The start scripts contain the logic to build the classpath, there is (I think) a shared directory where the schemas for the xml files are put.

Best regards
Jürgen
Reply all
Reply to author
Forward
0 new messages