Failed to synchronize RAPID PERS variable (1104002)

My AppStudio app is reading the names of all installed modules. And the writing the names to PERS string variables, so I can use them in RAPID code. The JS code generated works fine. If I run it while the task T_ROB1 is stopped there is no problem. But if T_ROB1 is executed, then I have popups and messages in the debug window. But the code is still running and the variables are filled properly. The Popup shows the title “1104002-Failed to sychronize RAPID PERS variable” and the message “The PERS sysnchrinization is not allowed during programm execution”. And the messages in debug window are “[ecosystem-rws] FailedToSendRWSPost {“message”:“Failed to sync pers. Task: T_ROB1. Module: STD”,“httpStatus”:{“code”:403,“text”:“Forbidden”},“controllerStatus”:{“name”:“SYS_CTRL_E_EXEC_STATE”,“code”:“-1073442809”,“severity”:“Error”,“description”:“Operation is illegal in current execution state.”}}” and “[ecosystem-rapid] FailedToSyncPersDuringExecution Failed to synchronize PERS. RWS post error code: -1073442809”. So I would like to know if there is a method of avoiding the popup and the message while the task is running? Because my task has to run while my app is executing.

Hi…
The error occurs because PERS type variables attempt to update the initialization value in the physical file (.mod) whenever they are changed. For safety, the controller blocks this writing to the file while the program is running.
Solution Suggestions:
1 - Change to Module VAR: If the names do not change during the loop or are resubmitted by AppStudio upon startup, use VAR. They are static in memory, but do not attempt to update the file during execution, eliminating the error.

2 - Use TASK PERS: If you are in a multitasking system, declaring as TASK PERS isolates the value for the specific task. This avoids global synchronization conflicts between tasks.

Good Job.

Hi mandolas,
Thank you for your answer. It pointed me to the right direction.
I tried to change to VAR. But I still had the issue.
But in the code to set the variable, i could set the syncPers property to false, which helped.
await API.RAPID.setVariableValue(
“STD”,
modName,
persName,
“T_ROB1”,
{ syncPers: false}
);

1 Like