Diagnosing Intermittent WinCC OS Client Freezes and Application Event 257 in SIMATIC PCS 7
Periodic WinCC OS Client freezes occurring every 2 to 3 days on Windows 7 SP1 accompanied by Windows Application Event 257 ('no redundancycontrol started, but all other conditions are set') are typically caused by unreleased Windows Region and Language locale settings triggering memory leaks in WinCC C-script threads, combined with orphaned redundancy configuration flags on the client project. To resolve this, enforce released Windows System Locale ('English (United States)'), eliminate orphaned redundancy settings in the OS Client project, verify memory utilization in Task Manager, and inspect C-scripts for handle leaks using apdiag.exe.
Table of Contents
- Mechanism of Periodic WinCC OS Client Freezes
- Analyzing Windows Application Event 257
- The Windows System Locale and C-Script Deadlock Connection
- Step-by-Step Diagnostic and Stabilization Procedure
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
Mechanism of Periodic WinCC OS Client Freezes
In SIMATIC PCS 7 v8.1 SP1 systems with multiple OS Clients running on Windows 7 SP1 (or Windows 10 LTSB), client workstations are designed to run continuously for months without interruption.
When an OS Client suffers a progressive freeze requiring a hard Windows restart every 48 to 72 hours:
* Task Manager typically reveals that physical RAM consumption or GDI Object counts for WinCC processes (such as PdlRuntime.exe or Script.exe) steadily creep upwards until Windows desktop heaps are exhausted.
* Standard WinCC diagnostics logs (WinCC\Diagnostics\*.log) often show no crashes because the processes do not terminate abnormally; rather, the user interface thread deadlocks.
Analyzing Windows Application Event 257
In the Windows Application Event Log, the appearance of Event ID 257 logging every 2 seconds:
* The Message: 'no redundancycontrol started, but all other conditions are set'
* The Underlying Component: Originates from the WinCC Redundancy synchronization service (RedundancyControl.exe).
* The Structural Error: In a PCS 7 client-server architecture, redundancy monitoring runs exclusively on OS Servers. An OS Client does not execute server redundancy. If an OS Client project was accidentally created by duplicating an OS Server project, or if the "Redundancy" checkbox was selected under WinCC Explorer on the client, the client attempts to launch redundancy watchdogs. Because partner server components are absent locally, Event 257 floods the event log every 2 seconds, consuming CPU cycles and logging handles.
The Windows System Locale and C-Script Deadlock Connection
Siemens SIMATIC PCS 7 enforces strict operating system regional requirements:
* String Parsing Vulnerability: WinCC C-scripts (C-Script Engine) and APL faceplates convert real numbers to strings and parse dates based on the Windows System Locale.
* The Locale Trap: If Windows is configured with an unapproved regional locale (such as Russian, Turkish, Greek, or customized decimal comma formats) while PCS 7 runs in English:
- C-runtime string functions (e.g. sscanf, sprintf, strtod) encounter unexpected formatting delimiters.
- The script engine gets trapped in infinite evaluation loops or leaks memory allocations (malloc without free) on every faceplate cycle.
- Over 2 to 3 days, this slow leak exhausts the 2 GB user-mode virtual memory space of 32-bit WinCC processes, freezing the client completely.
The following table summarizes the diagnostic signatures and corrective actions for client workstation freezes:
apdiag.exe Output Windowfree) and delete GDI objects.apdiag.exeStep-by-Step Diagnostic and Stabilization Procedure
To restore permanent stability to the OS Client:
[Step 1: Correct Windows Regional Settings]
│ • Open: Windows Control Panel -> Clock, Language, and Region -> Region and Language
│ • Format Tab: Set to "English (United States)"
│ • Location Tab: Set to "United States" (or primary facility country)
│ • Administrative Tab -> Language for non-Unicode programs:
│ - Set: "English (United States)" <-- MANDATORY FOR SCRIPT ENGINE
│ • Reboot computer to apply system-wide font and number metrics
▼
[Step 2: Clean OS Client Project in SIMATIC Manager]
│ • Open OS Client project in WinCC Explorer
│ • Expand: Redundancy -> Ensure "Activate Redundancy" is COMPLETELY UNCHECKED
│ • Verify: Computer Properties -> Computer Type is set to "Client"
▼
[Step 3: Monitor C-Script Engine via apdiag.exe]
│ • Open: C:\Program Files (x86)\Siemens\WinCC\bin\apdiag.exe
│ • Select: Output Window -> Open
│ • Select: Diagnosis -> Trace Options -> Check for executing script loops
└─► Identify and correct custom cyclic scripts leaking handles
Verification
To confirm that the OS Client stability has been restored:
1. Open Windows Event Viewer (Application Log); verify that Event ID 257 has completely stopped repeating.
2. Launch WinCC Runtime on the OS Client and open Task Manager (Details / Processes Tab).
3. Add the columns: Memory (Private Working Set), Commit Size, and GDI Objects.
4. Continuously operate faceplates and screen switching for 24 hours; verify that PdlRuntime.exe memory usage stabilizes at a flat plateau (< 600 MB) rather than growing continuously.
5. In apdiag.exe, confirm that the script queue remains empty and no timeout errors are logged during peak shift operations.
Limitations and Operational Precautions
Never modify Windows regional formatting settings on a running OS Client while WinCC Runtime is active. Changing system locales dynamically corrupts active SQL Server database connections and causes immediate runtime termination. Always deactivate WinCC, close all engineering tools, change regional settings, and perform a full system reboot.
Engineer FAQ
Why did Event 257 occur only on one OS Client?
That specific client project likely had the 'Redundancy' editor activated or was generated from an improperly converted server template, causing it to look for redundant partner servers locally.
Can an unreleased keyboard layout cause WinCC to hang?
While keyboard layouts generally affect text entry, the underlying 'System Locale' (Language for non-Unicode programs) governs ANSI string evaluation in WinCC C-scripts. Mismatches here cause script engine hangs.
What is the normal GDI Object limit for WinCC on Windows 7?
Windows enforces a default ceiling of 10,000 GDI objects per process. If PdlRuntime.exe exceeds 9,000 GDI objects, the client interface freezes and buttons stop rendering.
How do I trace memory leaks in custom WinCC scripts?
In apdiag.exe, execute Count Functions and inspect Memory Allocation. Functions with a high allocation count that never decrease indicate unreleased dynamic memory.
Technical References
- SIMATIC Process Control System PCS 7 - PC Configuration Manual (V8.1 / V8.2) - A5E36188414-AA
- SIMATIC HMI WinCC V7.4 / V7.5 WinCC Information System - Scripting
- Siemens Industry Online Support (SIOS) Entry ID 109780813 - Regional Settings in PCS 7
Related Articles
- Preventing Antivirus Memory Leaks and OS Server RAM Crashes (Symantec Endpoint Protection) in SIMATIC PCS 7 WinCC
- Resolving Windows Paging File Usage Alarms and Configuring Virtual Memory in SIMATIC PCS 7 OS
- Troubleshooting Disappearing APL Faceplate Checkboxes in SIMATIC PCS 7 WinCC - Windows DPI Scaling Resolution
Related Tags
- OS Client Freeze
- Event 257
- System Locale
- C-Script Leak
- WinCC Redundancy