← Volver al blogBack to the blog

Fantasmas de comunicación: las conexiones OPC que nadie cerróCommunication ghosts: the OPC connections nobody closed

Sala de gabinetes de control donde unas pocas líneas de datos sólidas y muchas líneas tenues, sin origen, llegan al mismo controlador

Hay fallas de comunicación que no empiezan con un error, sino con una desconexión que parecía normal. Una aplicación se cierra, se reinicia o pierde la red, vuelve a conectarse y todo sigue funcionando. Lo que nadie ve es lo que quedó atrás en el sistema de control.

Qué es un fantasma de comunicación

Cuando un cliente OPC se conecta, pide al servidor que le reserve recursos: una sesión, grupos de variables y suscripciones para recibir los datos. Al terminar, el cliente debe liberar todo eso de forma ordenada.

Una conexión fantasma es la que un cliente dejó abierta al reconectarse sin cerrar la anterior. Ya no hay nadie detrás, pero sigue ocupando recursos en el servidor, que continúa atendiendo consultas que nadie recibe.

Por qué se generan

  • El cliente se reconecta sin cerrar la conexión anterior. Es la causa principal. Ante cualquier interrupción, la aplicación abre una sesión nueva con nuevas suscripciones y deja viva la que tenía.
  • El cliente está mal programado y no libera sus comunicaciones OPC al desconectarse.
  • La aplicación se cierra de forma abrupta o se corta la red. El cliente no alcanza a avisar que se va, y su conexión queda abierta hasta que el servidor la da por perdida. Si mientras tanto se reconecta, se suma otra.

Cómo crecen sin que nadie lo note

Un fantasma por sí solo no hace daño. El problema es que se acumulan. Cada desconexión mal cerrada deja otro conjunto de consultas activas, y una aplicación que se reconecta varias veces al día puede multiplicar su carga sobre el sistema de control sin que nada cambie a la vista.

No hay alarma. Las aplicaciones reciben sus datos, las pantallas funcionan y la carga sube un poco cada semana. Desde el punto de vista del sistema de control, el número de clientes y de consultas crece, aunque en la planta haya las mismas aplicaciones de siempre.

Cómo termina

Termina cuando la carga acumulada supera lo que las comunicaciones del sistema de control pueden atender. Las comunicaciones colapsan y la única salida es reiniciar los servicios del DCS para limpiar todo lo que quedó abierto.

Ese reinicio afecta a la operación, y además borra la evidencia: después de reiniciar todo vuelve a funcionar, la causa queda sin identificar y el ciclo comienza otra vez.

Cómo detectarlos

  1. El sistema de control muestra más clientes o más consultas activas que las aplicaciones realmente conectadas.
  2. La carga de comunicaciones aumenta con el tiempo sin que se hayan agregado aplicaciones ni variables.
  3. Los problemas desaparecen después de un reinicio y vuelven semanas o meses más tarde.

También conviene probar a los clientes antes de conectarlos. Kapptek OPC Enlace, nuestra aplicación gratuita, actúa como servidor de prueba para comprobar que los clientes de terceros liberan sus conexiones y cómo reaccionan ante cortes, y entrega un informe de auditoría.

Cómo ayuda OPC Nexus

OPC Nexus se ubica entre las aplicaciones y el sistema de control, y aborda el problema en tres frentes.

  • Protege siempre al sistema de control. Los clientes OPC DA y UA se conectan al puente, no al DCS. Hacia el sistema de control, OPC Nexus mantiene una sola suscripción, independiente de cuántos clientes haya conectados del otro lado, sean reales o fantasmas. Los fantasmas no llegan al DCS.
  • Detecta los fantasmas. Identifica cuando un mismo cliente mantiene más conexiones simultáneas que las toleradas y, si la situación persiste, marca las más antiguas como fantasmas. También reconoce cuando hay evidencia directa de que el cliente ya no está, porque su proceso terminó o cerró su conexión de red. En ambos casos lo registra y genera una alerta.
  • Los contiene. Según la política configurada, solo detecta y avisa, o además cierra las conexiones fantasma para liberar los recursos, mientras el cliente real sigue conectado.

Y deja la evidencia

El reinicio de servicios borraba el rastro. OPC Nexus lo conserva: su agente virtual resume en lenguaje natural cuántas conexiones fantasma hay en este momento, qué cliente las deja y cuántas veces ocurrió en el período revisado. Además, cada apertura y cierre de sesión queda registrado, lo que permite reconstruir la historia de conexión de cualquier cliente.

Con esa información se puede ir al proveedor de la aplicación con datos concretos, en lugar de reiniciar y esperar a que vuelva a pasar. Sumado al control de la carga de escrituras, esto mantiene el DCS estable sin depender de que cada aplicación de terceros se comporte bien.

Some communication failures do not start with an error, but with a disconnection that looked normal. An application closes, restarts or loses the network, reconnects, and everything keeps working. What nobody sees is what was left behind in the control system.

What a communication ghost is

When an OPC client connects, it asks the server to reserve resources for it: a session, groups of variables and subscriptions to receive data. When it finishes, the client must release all of that in an orderly way.

A ghost connection is one that a client left open when it reconnected without closing the previous one. Nobody is behind it anymore, but it still takes up resources on the server, which keeps serving requests that nobody receives.

Why they appear

  • The client reconnects without closing the previous connection. This is the main cause. After any interruption, the application opens a new session with new subscriptions and leaves the old one alive.
  • The client is poorly programmed and does not release its OPC communications when it disconnects.
  • The application closes abruptly or the network drops. The client never gets to announce that it is leaving, and its connection stays open until the server gives it up for lost. If it reconnects in the meantime, another one is added.

How they grow unnoticed

A single ghost does no harm. The problem is that they accumulate. Each badly closed disconnection leaves another set of active requests, and an application that reconnects several times a day can multiply its load on the control system with no visible change.

There is no alarm. Applications receive their data, displays work and the load rises a little every week. From the control system's point of view, the number of clients and requests grows, even though the plant has the same applications as always.

How it ends

It ends when the accumulated load exceeds what the control system's communications can handle. Communications collapse and the only way out is to restart the DCS services to clear everything that was left open.

That restart affects operations, and it also erases the evidence: after the restart everything works again, the cause remains unidentified and the cycle starts over.

How to detect them

  1. The control system shows more clients or more active requests than the applications actually connected.
  2. The communication load increases over time although no applications or variables have been added.
  3. Problems disappear after a restart and return weeks or months later.

It also pays to test clients before connecting them. Kapptek OPC Enlace, our free application, acts as a test server to check that third-party clients release their connections and how they react to outages, and delivers an audit report.

How OPC Nexus helps

OPC Nexus sits between the applications and the control system, and addresses the problem on three fronts.

  • It always protects the control system. OPC DA and UA clients connect to the bridge, not to the DCS. Towards the control system, OPC Nexus keeps a single subscription, regardless of how many clients are connected on the other side, real or ghost. Ghosts do not reach the DCS.
  • It detects ghosts. It identifies when the same client holds more simultaneous connections than tolerated and, if the situation persists, marks the oldest ones as ghosts. It also recognizes when there is direct evidence that the client is gone, because its process ended or it closed its network connection. In both cases it logs the event and raises an alert.
  • It contains them. Depending on the configured policy, it only detects and warns, or it also closes the ghost connections to free the resources, while the real client stays connected.

And it keeps the evidence

Restarting services used to erase the trail. OPC Nexus keeps it: its virtual agent summarizes in natural language how many ghost connections there are right now, which client leaves them and how many times it happened in the period reviewed. In addition, every session opening and closing is logged, which makes it possible to reconstruct the connection history of any client.

With that information, you can go to the application's vendor with concrete data, instead of restarting and waiting for it to happen again. Together with control of the write load, this keeps the DCS stable without depending on every third-party application behaving well.