Troubleshooting
PLC shutdown on MQTT connect after firmware upgrade
Short answer
A controller that creates the MQTT client but shuts down at the connect call has a firmware and library pairing fault, not an MQTT handshake fault. Stop calling connect, restore the firmware release the library documents, or hold the connect call disabled, then qualify an updated library with a connect-only test — client created, connect completes, session accepted — before continuous deployment.
On this page
A controller that creates the MQTT client object and then shuts down the moment the application calls connect has a firmware and library pairing fault, not an MQTT handshake fault. In the reported case, an AXC F 2152 ran the IIoT Library for about six months on firmware 2020.6; after the controller moved to firmware 2021.0.3, with the engineering project on PLCnext Engineer build 2021.0.1, every connect attempt stopped the controller while client creation still worked. The library had been released for firmware 2020.6 and had no confirmed update for the newer release at the time of the fault. The decision: stop calling connect, return the controller to the firmware and library pair the library documents, and qualify any updated library with a connect-only test — client created, connect completes, session accepted — before continuous deployment.
Where the MQTT data path stops #
Follow the call from the application outward and mark the last stage that completed. Each stage exercises a different layer of the controller:
| Stage | What it exercises | Reported result | Meaning |
|---|---|---|---|
| Instantiate the MQTT client | Project compilation and library loading | Completes | The library loads; the pairing is still unproven |
| Create the client for the configured server | Library-internal setup | Last entry written to Output.log |
Execution reaches the library's client-creation path |
| Request the server connection | Firmware networking and service libraries | Controller shuts down | The fault window is the connect path |
| Publish or subscribe | Session, topics, payloads | Never reached | Topic and payload handling sits outside the fault |
Count the boundary in stages: the path has 4 stages, 1 completes and 1 fails, so 4 - 1 - 1 = 2 stages never ran. Topic names, payloads and subscription callbacks cannot be the cause, because none of them executes before a session exists.
A refused connect is a normal protocol outcome: the MQTT specification returns a rejection to the client as a CONNACK result code, the client reports it, and the client keeps running. The protocol defines no outcome in which a refused session stops the controller, so a shutdown on connect points first at the runtime dependency chain rather than at the broker. That is what separates this case from a handled connect-time result like the one in why a PLCnext MQTT client reports ENO false before broker checks.
Why an upgrade breaks a working library #
Client creation proves compilation and library loading, and nothing more. The connect call is the first step that crosses into the firmware's networking and service libraries, and a firmware release can change exactly those parts. The controller's own firmware change notes record one such change: a release moves to a newer OpenSSL version, with the previous 1.1.1 library kept only for compatibility. A library built against the older service set carries no guarantee once the runtime under it changes. This is the same version-pairing rule that makes a runtime installer refuse an unsupported controller OS, described in when a PLC runtime installer fails on the controller OS. Compilation and instantiation are not qualification; a completed connection is.
Rule the network out first #
A disconnected cable, an inactive switch port, a wrong server address, a closed server port or an unreachable broker explains a failed connection, but none of these conditions shuts a controller down — each should return as a handled failure the client reports. The walk from a PLC to a broker across those checks is laid out in fix a PLC MQTT client that never reaches your broker. Work them anyway, for two reasons: a network fault can be the trigger that exposes the library defect, and the qualification test later in this article needs a reachable server before a session acceptance means anything.
Record the shutdown sequence as evidence:
- The physical link state at the controller and at the switch during the attempt.
- The configured server address and port, checked against the broker's actual listener.
- The exact order of events: client created, connect requested, controller stopped.
- The last lines of
Output.log— in the reported case, a client created for the given server, then silence.
Silence after client creation is not evidence of a broker refusal, because a refusal would arrive as a handled connection result.
The decision for each situation #
| Action | What it gives you | Constraint | Use it when |
|---|---|---|---|
| Return the controller to the firmware release the library documents | MQTT service on a pair with months of runtime behind it | Whatever made the newer firmware necessary must wait or move elsewhere | Service has to come back before a matching library exists |
| Install a library release the developer documents for the newer firmware | Keeps the newer firmware in place | Only a release the developer lists for your firmware counts, not merely a newer build number | The developer publishes a matching release |
| Hold the connect call disabled on the newer firmware | No shutdown loop | The MQTT data path stays dark; acceptable on an isolated controller only | Change control forbids the rollback and no library exists yet |
Decide in that order: restore the documented pair, qualify the updated library when one appears, and never leave a production controller on a pair that shuts down on connect.
Restore the documented pair #
A controller that can stop itself from an application call must not carry machine control while that call is armed, so run this recovery on an isolated controller.
- Disable the cyclic or automatic connect request so the controller cannot fall back into the shutdown loop.
- Archive the application, the controller configuration, the library package,
Output.logand the controller diagnostics. - Record the server address, the server port and every connection setting, so the firmware change stays the only variable.
- Return the controller to the firmware release the library documents, using the manufacturer's documented firmware installation procedure for this controller model.
- Redeploy the application with the library version that previously ran on that release.
- Start one client instance and trigger one connect manually, with publish and subscribe still disabled.
- If the controller keeps running, add publish, then subscribe, one stage at a time.
If change control blocks the rollback, leave the connect call disabled and send the developer the evidence package described in the questions below.
Qualify an updated library with a connect-only test #
Qualification proves controller stability and MQTT progression separately, gate by gate. Run it on the isolated controller against a reachable test server, for example a broker at 192.168.1.50 listening on port 1883:
| Gate | Pass condition | Fail action |
|---|---|---|
| 1 — client creation | Client object created, controller still running | Check deployment and library loading |
| 2 — connect | One connect request completes without a shutdown | Recheck the firmware and library pairing; collect runtime diagnostics |
| 3 — session | The server accepts the session, a successful CONNACK in the client result or broker log | Correct address, port or TLS settings, then retest gate 2 |
| 4 — round trip | One publish and one received subscription message on a known test topic | Check topic configuration only after gates 1 to 3 pass |
Count the evidence before you deploy: 4 of 4 gates passed, 1 session accepted, 1 published message confirmed on the server, 1 received message confirmed in the client, and 0 unplanned controller restarts. Record the controller firmware version and the library version before and after the test; the qualification holds only for that exact pair, and any later firmware or library change puts the gate count back to 0. Continuous deployment begins once all four gates pass on the recorded pair — not when the project builds and the client instantiates.
If rollback is blocked and no library exists yet #
Take the MQTT client off the controller. A dedicated edge host in the same cabinet — for example an industrial mini PC running the broker client and feeding your data pipeline — collects the MQTT data while the controller runs only its control program, and the controller is never exposed to a connect call that stops it. When the developer publishes a library documented for the newer firmware, run the four gates above on the controller before moving the client back.
Questions asked
Why does creating the client succeed while connect shuts the controller down?
Loading a library links it into the runtime; creating the client builds an object in memory. Neither exercise reaches the parts of the controller that the firmware upgrade changed. The connect call is the first step that calls into the firmware's networking and service libraries, and that is exactly where the reported fault sits. A clean build and a successful instantiation prove nothing about the pairing.
What should I send the library developer when I ask about firmware support?
Use the contact option on the library's app page in the PLCnext Store. Include the controller model, the firmware release that worked, the release that fails, the engineering tool build, the exact library version, a minimal project that only creates the client and calls connect, the last lines of the Output.log file, and the controller diagnostics.
Can a wrong broker address or a closed port shut the controller down?
No. A wrong address, a closed listener port or an unreachable broker ends as a handled connection failure the client reports, and the runtime keeps running. Check the network settings anyway before the qualification test, because the connect has to reach a live server before a session acceptance means anything.
What proves the broker actually accepted the session in gate 3?
A TCP connection to the broker's port is not acceptance; sockets open before the MQTT handshake and can succeed on a broker that then refuses the session. The evidence is the MQTT-level acknowledgement of the connect, a successful CONNACK, visible in the client's connect result or in the broker's log entry for the new client.