IMD SolutionComputing LibraryShop main store

Troubleshooting

Why gateway scripts stop when the Ignition Edge Designer closes

Edge computing and IIoT Published 7 min read

Short answer

If handshake or reset logic on an Ignition Edge gateway only runs while a Designer or Perspective session is open, the logic lives in session-scoped objects, which stop when nothing hosts a view. Move it to a Gateway Event timer or a tag event script keyed off the tag timestamp, then verify with zero sessions connected.

On this page
  1. Why session-scoped logic dies with the Designer
  2. Check the transport before blaming the script
  3. Classify every writer by execution scope
  4. When a gateway script really should run but does not
  5. Move the reset into gateway scope
  6. Timing the reset for a 2 s handshake with a 500 ms timer
  7. Verify it runs with zero sessions
  8. Questions asked

A script or binding on an Ignition Edge gateway that only runs while the Designer is open is not gateway script at all: it lives in a Perspective session-scoped object, and session-scoped objects stop evaluating the moment nothing hosts a view. The fix is to classify every writer of the tag by execution scope, move the logic into gateway scope, and verify it with zero sessions connected.

This page works through a request/acknowledge handshake: a main gateway writes True to a reference tag on the Edge gateway, and Edge-side logic writes False back after a 2 s hold. With the Designer closed, the tag latched True. The same pattern applies to any reset, refresh, or derived value that must run unattended on an Edge box.

Why session-scoped logic dies with the Designer #

Perspective objects run under a session lifecycle. A session custom property with a binding or script transform, a view or component binding with a transform, a property change script, and session events only execute while a client session or a loaded Designer view exists. A Designer with the view loaded is such a host, which is why everything appeared to work during commissioning. When the last session closed and the Designer shut, nothing evaluated those bindings, so nothing wrote the reset.

Gateway-scoped logic behaves differently. A Gateway Event timer script, a Gateway Event tag change script, and a tag event script defined on the tag itself all run in the gateway process with no clients connected. Note that before Ignition 8.1.32, a tag event script fires on quality and timestamp changes as well as value changes, because tags carry a value, quality, and timestamp together; design the script to tolerate that.

Check the transport before blaming the script #

Before touching script scope, confirm the write from the main gateway actually lands on the Edge tag. Work down the hops in order and stop at the first bad reading.

  • Physical link: link LEDs up, and a ping from the main gateway host to the Edge host succeeds. A layer-one or IP fault here explains everything else.
  • Gateway Network connection: on each gateway's status connections page, the connection must show running on both ends. An unapproved certificate, a rejected connection, or a blocked port breaks the path.
  • Remote tag provider on the main gateway: the reference tag's quality in the tag browser must be good. Stale or bad quality means the provider cannot read the Edge provider.
  • Service Security on the Edge gateway: the tag access level granted to the security zone containing the main gateway must allow writes. A read-only level lets reads succeed while silently rejecting writes.
  • The Edge tag itself: after a test write, the value and timestamp must change in the Edge gateway's own tag browser. No change means the write never arrived.

If the tag goes True with a fresh timestamp, transport is good and the fault is scope. If it never changes, fix the connection or access level first.

Classify every writer by execution scope #

Open every place that could write the handshake tag on the Edge project and sort it:

  • Gateway Events timer script: gateway scope, runs with no session.
  • Gateway Events tag change script: gateway scope, runs with no session.
  • Tag event scripts on the tag itself, such as a value changed script: gateway scope, runs with no session.
  • Perspective session custom properties with bindings or transforms: session scope, does not run headless.
  • View or component property bindings, script transforms, and change scripts: session and view scope, run only while the view is open.
  • Perspective session events: session scope, does not run headless.

If the reset lives in any session-scoped row, that is your fault; move it using the procedure below. If the reset genuinely lives in a gateway-scoped row and still stalls, work the next checklist.

When a gateway script really should run but does not #

  • Save and enable: unsaved Designer edits never reach the gateway, and the project must be enabled on the Edge gateway's web page.
  • Gateway scripting project: tag event scripts that call project library functions resolve through the gateway's configured scripting project; point it at the Edge project.
  • Tag path provider: in gateway scope, use fully qualified paths with the provider name exactly as the Edge tag browser shows it. A wrong or missing provider fails silently.
  • Gateway logs: filter the Edge gateway's diagnostics logs for script errors, and add a logger through system.util.getLogger inside the script to prove each execution.
  • Blocking sleep: a sleep call inside a tag event script holds a shared tag-event thread; repeated handshakes then queue or drop. Replace it with the timestamp pattern below.
  • Licensing: gateway event scripting on Edge depends on Edge Compute being active on the license page of the Edge gateway.

If all six pass and a clean timer script still stops on your exact build, capture the script, the logs, and the gateway version, and take it to the vendor's support with that evidence.

Move the reset into gateway scope #

  1. Delete or disable every session-scoped writer of the handshake tag. Two writers in different scopes race each other.
  2. In the Edge Designer, add a Gateway Events timer script with a fixed-delay rate well below the 2 s hold time. The rate is a design choice; see the worked example.
  3. Key the reset off the tag timestamp instead of sleeping. The pattern below uses documented Ignition scripting functions (system.util.getLogger, system.tag.readBlocking, system.date.millisBetween, system.date.now, system.tag.writeBlocking) with illustrative variable names of our own.
  4. Use a fully qualified tag path with the Edge provider name.
  5. Save the project so the gateway loads it.
log = system.util.getLogger('HandshakeReset')
path = '[YourEdgeProvider]Path/To/HandshakeTag'
qv = system.tag.readBlocking([path])[0]
if qv.quality.isGood() and qv.value:
    age_ms = system.date.millisBetween(qv.timestamp, system.date.now())
    if age_ms >= 2000:
        system.tag.writeBlocking([path], [False])
        log.info('Handshake reset after %d ms' % age_ms)

Because the script computes elapsed time from the timestamp, no thread is held, and a missed timer tick simply catches the reset on the next pass. Audit display logic the same way: a historical binding with a script transform on a session property stops updating headless too, so compute such values in a gateway script and write them to a memory tag that views only read.

Timing the reset for a 2 s handshake with a 500 ms timer #

Inputs: the hold time is 2 s, taken from the handshake requirement itself; the timer rate is 500 ms, chosen as a design value well below the hold time; the reset condition triggers once the tag has been True for at least 2000 ms.

Rule in words: with a fixed-delay timer, the reset fires on the first timer pass at or after the hold time expires, so the worst-case delay is the hold time plus one full timer period.

Arithmetic: earliest reset = 2000 ms (the tag reaches 2000 ms of age and the condition passes on the pass that observes it). Latest reset = 2000 ms + 500 ms = 2500 ms, if the threshold is reached just after a pass. So the reset lands between 2000 ms and 2500 ms after the request, and the acknowledgement window is 2.0 to 2.5 s.

Decision: pick the timer rate so that hold time + rate stays inside what the receiving device tolerates. At a 500 ms rate the window is 2.0-2.5 s; if the receiver demands the acknowledgement inside 2.2 s, drop the rate to 100 ms for a 2.0-2.1 s window. A rate far below 100 ms buys nothing and loads the tag-event machinery.

Verify it runs with zero sessions #

  • Close every Designer connected to the Edge gateway.
  • On the Edge gateway's status page, confirm zero active Perspective sessions, and close any browser or panel client still attached.
  • From the main gateway, write True to the reference tag.
  • Watch the tag: it must return to False on its own, with the logger line in the Edge gateway logs giving the elapsed age in milliseconds.

If it resets with zero sessions and no Designer, the handshake now lives entirely in the gateway process, where it belongs.

One safety note: a handshake that latches a request state can hold an output, interlock, or permissive True indefinitely. Before deploying the headless version, confirm with the process owner that a stuck-True state on this tag cannot drive equipment unsafely, and that the receiving logic has its own timeout if it must.

When you audit how your Edge data reaches derived values and displays, the same session-versus-gateway distinction is behind binding behavior; the page on replacing Perspective tag bindings while preserving transforms covers that side of the design.

Questions asked

Do Gateway Event scripts run when no Perspective session is connected?

Yes. Gateway Event timer scripts, Gateway Event tag change scripts, and tag event scripts defined on the tag itself execute in the gateway process and run whether or not any Designer or Perspective session exists. If a script you believe is gateway-scoped still stops when sessions close, the fault is elsewhere: check that the project was saved and enabled, that the gateway's configured scripting project points at your Edge project, and that the tag paths are fully qualified with the correct provider.

Why should I avoid system time sleep calls in tag event scripts?

A sleep such as a two-second wait inside a tag event script blocks one of the gateway's shared tag-event threads for its whole duration. Under repeated tag changes, later events queue behind it or get dropped, which shows up as missed handshakes or lost updates. Computing elapsed time from the tag's own timestamp lets the script return immediately and catch any reset it missed on the next pass.

Does the tag timestamp always change when the tag is written?

A memory or reference tag that you write through scripting takes a new timestamp on each write, so timestamp-based elapsed-time logic works directly on it. A tag driven by a device connection may refresh its timestamp on every poll whether or not the value changed. For that kind of tag, latch the request time into a separate memory tag from a tag change script and compute the age from that latched value instead.

Can a script transform on a Perspective binding run headless?

No. A script transform belongs to the binding, and the binding belongs to a view component, so it is only evaluated while something hosts that view: an open browser client, a panel session, or a Designer with the view loaded. To keep derived data current with no sessions, compute it in a gateway script and write the result to a memory tag that views read.

Keep reading

  • Troubleshooting

    Run central tag event scripts on remote Edge tags

    Tag Event scripts on tags hosted by a remote tag provider do not execute on the central Ignition gateway: the provider shares values and definitions, not event execution. Host the logic in a Gateway Tag Change event on the central gateway, subscribed to the remote tag's provider-qualified path.

    Edge computing and IIoT

  • Explainer

    ABB TotalFlow module for Ignition: what exists today

    The ABB TotalFlow entry on the Ignition Edge IIoT page is an entitlement, not a download: the driver is a third-party Cirrus Link module that reached beta after that listing was written. It runs on Ignition Edge and standard Ignition, polls G2 late, G3, G4 and G5 flow computers, and needs MQTT Transmission to publish, because the G5 has no native MQTT client.

    Edge computing and IIoT

  • Comparison

    Getting Wonderware Historian data into Ignition Edge for MQTT

    Yes — Ignition Edge can publish this data as MQTT Sparkplug, but through two separate routes. Live values come from the existing DAServer acquisition layer behind a DA-to-UA gateway, because Edge's OPC client is UA-only. History and aggregates come from SQL queries against the Historian Runtime database, using its documented stored procedures.

    Edge computing and IIoT