Troubleshooting
Fixing CODESYS OPC DA memory growth stopping SCADA reads
Short answer
The reads stop because WinCoDeSysOPC.exe, a 32-bit OPC DA server process, climbs to its 2 GB memory ceiling over weeks and then stops serving tags; killing it only resets the clock. The resolution that held was installing the current, licensed CODESYS OPC DA server — 3.5.22.40 in place of the CODESYSV35SP10Patch2 install — and proving it through the old failure window.
On this page
- Why the process dies at about 2 GB
- Checks that put the fault on the server process
- Setting the process-memory alert with working margin
- Why killing the process is a recovery, not a fix
- Install the current licensed server
- Prove the fix through the old failure window
- When you can leave OPC DA behind
- Questions asked
SCADA reads that die after a few weeks and return the moment you kill WinCoDeSysOPC.exe are a middleware failure, not a PLC fault. That executable is the CODESYS OPC DA server: a 32-bit program whose usable memory tops out at 2048 MB, and in the installation that produced this pattern it climbed a little every day and stopped serving tags at about that ceiling. Assertions in the server log time-stamp the failure. Restarting the process resets the clock and nothing more. The resolution that held was a licensed, current server — release 3.5.22.40 replacing an install from CODESYSV35SP10Patch2 — proven by a memory trend held through the old failure window. Work the checks below in that order.
Why the process dies at about 2 GB #
A 32-bit process can only use 2 GB of memory. That ceiling belongs to the process, not to the PC, and WinCoDeSysOPC.exe behaves as a 32-bit process: its memory rises slightly each day, the reads stop somewhere near the limit, and the server never rebuilds the connection on its own. Killing the process manually frees the accumulated memory and the SCADA client reconnects.
The log under C:\ProgramData\CoDeSysOPC adds the fingerprint: assertions in ..\ServerToolkit3_1\ServerToolkit\RuntimeLIB\OPCTag.cpp at line 1180 and line 1186, logged in pairs at the same timestamp while communication is down. They mark where inside the server toolkit's tag runtime the failure was caught. They do not name a tag, a client or a PLC address, so there is nothing to gain from auditing tags one by one.
On the screen the symptom is frozen or stale values — the same appearance PLC comms timeouts produce, which is why HMI values show question marks during PLC comms timeouts in that other fault chain. The tell here is the sequence: the server's memory climbs for weeks first, then the reads stop.
Checks that put the fault on the server process #
- Record the baseline while reads still work: the WinCoDeSysOPC.exe memory figure from Task Manager, the time, and the version string from the server's own version information. Keep the two versions separate — CoDeSys v2.3.9.61 is the PLC programming environment, and the server itself came from CODESYSV35SP10Patch2.
- Trend that same memory figure at a fixed interval — daily matches the observed day-by-day growth — and note beside each reading whether SCADA values are updating. A steady climb with reads still live is accumulation in the server; keep trending.
- While the reads are stopped, connect to the PLC with the programming tool. If the controller answers, the PLC and its network are not the faulted layer, and the OPC server process is.
- Capture the failure evidence before any restart: copy the log files from C:\ProgramData\CoDeSysOPC and line up the OPCTag.cpp assertions at lines 1180 and 1186 with the last memory reading and the time the reads stopped.
- End the process once, as a controlled recovery, then record the new baseline and confirm the reads return. A clean recovery after the kill confirms the diagnosis; it changes nothing about the cause.
Setting the process-memory alert with working margin #
Inputs, each with its source:
- Ceiling: the documented maximum usable memory for a 32-bit process, as above.
- Failure point: about the same mark, where the affected installation lost its SCADA reads after a few weeks of daily growth.
- Alert rule: three-quarters of the ceiling, so the last quarter of the address space is working margin to capture evidence and schedule the change.
The rule in words: alert level = ceiling × 0.75.
The arithmetic: 2048 MB × 0.75 = 1536 MB. Headroom remaining when the alert fires: 2048 MB - 1536 MB = 512 MB.
Result: set a process-memory alert at 1536 MB on WinCoDeSysOPC.exe — the Details tab of Task Manager for spot checks, the matching process-memory counter in Performance Monitor for a logged trend.
Decision: once the process crosses 1536 MB after a restart, recurrence is proven. Capture the reading, the timestamp and the adjacent log lines, then book the server update. A crossing inside the first week after a restart leaves days of margin, not weeks — update immediately rather than waiting for the next planned outage. Below that level on a flat line, keep trending and change nothing.
Why killing the process is a recovery, not a fix #
Terminating the server frees the accumulated memory and the client reconnects — that is everything it does. The growth mechanism is still in the build, so the same climb restarts from the new baseline, and every kill discards the running state that shows the failure forming. A scheduled kill, nightly or weekly, is a bridge with an end date, never the remedy. One caution belongs here: if the SCADA client writes setpoints through this server, each kill-and-reconnect drops writes mid-flight, so run any bridge restart while the line is idle.
Install the current licensed server #
The failing build came from CODESYSV35SP10Patch2 — CODESYS V3.5 SP10. The current CODESYS OPC DA Server SL release is 3.5.22.40, article number 2302000028, and the vendor's own pages pair V3.5 SP19 with version 3.5.19.0, which puts the 3.5.22.40 line at SP22 — 22 - 10 = 12 service packs past the installed build. CODESYS documents service packs at annual intervals, so the old server is missing roughly a dozen years of fixes. That is the gap the update closes.
- Book an outage: reads and any writes through this server drop during the change.
- Back up the server configuration and note the SCADA client's server references, so the reconnect is a restore rather than a rebuild.
- Get the CODESYS OPC DA Server SL from CODESYS together with its license, and activate the license through the vendor's licensing process.
- Install it, then read the version from the server's own version information — not from the installer's completion screen, and not from the PLC project.
- Reconnect the SCADA client and take a fresh memory baseline the same day.
Prove the fix through the old failure window #
Acceptance is not the first hour of good data. Run the same trend, at the same interval, for at least the period the old build needed to fail — a few weeks on this pattern. A flat baseline, a log free of fresh OPCTag.cpp assertions and sustained reads together close the case. If the climb resumes on the current licensed build, capture the version, the license state, the memory trend and the log excerpt, and take that package to the vendor rather than restarting the process again.
When you can leave OPC DA behind #
OPC DA keeps DCOM-era configuration on the SCADA PC, and this failure lives in that middleware. The CODESYS OPC UA server exposes the project's variables to OPC UA clients directly, which removes the failing process from the chain — though UA writes have their own failure modes, as the traced case of fixing robot Profinet output writes over OPC UA shows. If the clients cannot move off DA, the updated licensed server above is the answer. If you are rehosting middleware anyway, take the OPC server off the SCADA workstation and run it on a dedicated gateway machine in the cabinet — an industrial mini PC — so a middleware restart never takes the operator's screen down with it.
Questions asked
Does adding RAM to the SCADA PC raise the 2 GB ceiling?
No. The ceiling belongs to the 32-bit process, not to the machine it runs on. Extra RAM gives other software room, but WinCoDeSysOPC.exe still stops at the same address-space limit and the reads still die after the same weeks of growth. The ceiling moves with a different server build, not with hardware.
Can I schedule a nightly kill of WinCoDeSysOPC.exe instead of updating?
It keeps reads alive, and against this weeks-long growth it is a workable bridge until the updated server goes in. It is not a fix: each kill drops any writes passing through the server, wipes the running state you need as evidence, and restarts the same climb from the new baseline. Run it only while the line is idle, and give it a scheduled end date.
Is CoDeSys v2.3.9.61 the version that needs updating?
No. That string identifies the PLC programming environment used for the controller program. The component that fails is the OPC DA server on the SCADA side, installed from CODESYSV35SP10Patch2. The license and the update both apply to that server, so read its version from its own version information and compare it against the current 3.5.22.40 release.
How long should the memory trend run before the fix is proven?
At least as long as the old build needed to fail — a few weeks on this pattern. The old installation lost communication only after weeks of daily growth, so acceptance means a flat baseline held through that whole window, a log with no fresh OPCTag.cpp assertions, and reads that never stopped. A quiet weekend proves nothing.
What do the OPCTag.cpp assertions at lines 1180 and 1186 tell me?
They tell you where inside the server toolkit the failure was caught, and when: the timestamps in C:\ProgramData\CoDeSysOPC mark the loss of communication. Use them to time-stamp the failure and to hand the vendor a clean evidence trail; tag-level and client-level detail has to come from the SCADA client's own logs, not from these lines.