Resolve handle leaks in Worker
If a Worker process on Windows gets stuck, throwing the following exception: oshi.software.os.windows.WindowsOperatingSystem.updateProcessMapFromRegistry[:489] - Error 5 reading HKEY_PERFORMANCE_DATA from the registry, the application stops working, and a manual restart is required.
The issue is associated with the v3.9.1.1 OSHI library, with handles leaked even in idle mode without any Business Process processing. The library is used to regularly get data about Worker processes, such as memory consumption (once per second). Sometimes, handles are not cleaned properly during multiple iterations, which totals up to accumulated 10K handles per hour. If you restart Workers regularly, the issue does not occur.
However, you can slow the handle leakage by increasing the intervals between system information requests. For that, introduce the two new settings:
worker.execution.memory.fixed.delay.millis: time period, in milliseconds, between system information requests. The default value is 1,000.worker.execution.memory.initial.delay.millis: time period, in milliseconds, before the start of the first system information request. The default value is 1,000.
To specify the settings as environment variables, complete the following steps:
Go to
RPA/bot-agent/conf/bot-agent-unit.ymlfor the server installation andRPA/worker/worker.batfor the VDI installation. Use the standard-Dswitch.Right after
-Djvm.connector.path=../rpa-grid/dependency/jvm-connector.jar, insert the following lines:-Dworker.execution.memory.fixed.delay.millis=60000 -Dworker.execution.memory.initial.delay.millis=120000Thus, the delay before you start getting system data is set to 2 (two) minutes, and the interval between requests—to 1 (one) minute.
Alternatively, you can choose one of the following methods to resolve the handle leakage issue:
- Upgrade the OSHI library to the newest version, which resolves the issue entirely
- Search for an alternative approach for getting system data