Debugging Container-Based Designer Modules

I’m looking for guidance on debugging modules in containers.

I have an 8.3.3 gateway (port 8089) running in a container with modules that I’d like to debug in IntelliJ.
Note that I also have an 8.1 gateway (port 8088) running directly on my computer.

When launching the debugger from IntelliJ, it does start the designer from the correct gateway and allow me to run tests from the script console.

I can set breakpoints in IntelliJ, but it never stops at them, not even in the DesignerHook’s startup(…).

Here’s the services section from the .yml file:

services:
  gateway:
    <<: *ignition-opts
    hostname: gateway
    ports:
      - 8089:8088
      - 8001:8000
    command: >
      -n Ignition-standard
      -m ${GATEWAY_MAX_MEMORY:-4096}
      -r /restore.gwbk
      -a gateway.localtest.me
      -h 8088
      -s 8043
      --
      wrapper.java.additional.1=-Ddata.dir=data
      wrapper.java.additional.2=--add-opens=java.base/java.lang=ALL-UNNAMED
      wrapper.java.additional.3=--add-opens=java.base/java.io=ALL-UNNAMED
      wrapper.java.additional.4=--add-opens=java.base/java.security.cert=ALL-UNNAMED
      wrapper.java.additional.5=--add-opens=java.base/java.util=ALL-UNNAMED
      wrapper.java.additional.6=--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED
      wrapper.java.additional.7=--add-opens=java.base/sun.nio.fs=ALL-UNNAMED
      wrapper.java.additional.8=--add-opens=java.base/java.lang.ref=ALL-UNNAMED
      wrapper.java.additional.9=-Xdebug
      wrapper.java.additional.10=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8000
      wrapper.java.additional.11=-Dignition.allowunsignedmodules=true
      wrapper.java.additional.12=-Dia.developer.moduleupload=true
    environment:
      GATEWAY_NETWORK_REQUIRESSL: false
      GATEWAY_NETWORK_SECURITYPOLICY: SpecifiedList
      GATEWAY_NETWORK_WHITELIST: Ignition-gatewayr-backup,Ignition-standard-backup
    volumes:
      - gateway-data:/usr/local/bin/ignition/data
      - ./gw-backup:/backup
      - ./gw-init/base.gwbk:/restore.gwbk
      - ./gw-init/gateway-${COMPOSE_PROFILES:-independent}.xml:/usr/local/bin/ignition/data/redundancy.xml

Are you trying to debug in the Designer scope or the Gateway scope? What does your IntelliJ launch config look like?

Designer scope.

IntelliJ debugger config:

JDK:
java temurin-17

module/classpath:
-cp designer-launcher

vm/cli options:
-Dignition.gateway.addr.0=localhost:8089 -Dignition.main=com.inductiveautomation.ignition.designer.DesignerStartupHook -Dignition.client.debug=true -Dautologin.username=admin -Dautologin.password=password -Dproject.name=dummy -Dignition.runtimeOverride=true -Dignition.version=dev -Dignition.client.logLevel=INFO @client-designer-args.txt

main method classpath:
com.inductiveautomation.ignition.client.launch.BootstrapSwing

What's this? Is the module you want to breakpoint in also on this classpath? A dependency of this project?

How do you expect your debugger to hook to the designer if you're not passing any debug args to the designer?

You're passing the gateway a flag opening port 8000 to serve the Java debug wire protocol:
wrapper.java.additional.10=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8000

But have no corresponding entry for the designer. It's a separate JVM/process, therefore needs its own instruction to serve JDWP on an open port.

I think Kevin's right, and while you need the JDWP instructions IntelliJ should be adding them to the command line automatically...

That would be if he's trying to attach to a Designer he didn't launch himself out of the IDE, no?

I read this as he's launching the Designer process from the IDE...

clarification needed I guess.

1 Like
  1. ‘designer-launcher’ is a Maven in the project that we are debugging.
  2. Do you have an updated link for this document from the wayback machine?
    Debugging in IntelliJ - Ignition SDK Programmer's Guide - Ignition Documentation
  3. It may be that I’m attached to a designer launcher process instead of the designer. I’m not sure how to tell. In the above, out-of-date document, there’s several instructions about scadarail VM options to set for debugging the designer. I have been assured by @Robert_McIlvenna that the settings do allow him to hit breakpoints in his projects that are running in his local gateway (not in a container). So, maybe a copy-paste issue, maybe we missed a step.

Yes, IntelliJ launches the designer when I click the debug button.

fwiw - This is a scripting module. We’re just calling the methods from the designer scripting console to test/debug the rpc interface. The functions work when called from gateway scope in a perspective event.

We found it: Don’t delegate runner actions to Maven:

Even though it was telling us we had valid breakpoints, we think it was attached to something else.
Turned this off and all the breakpoints work.

3 Likes