I have a virtual element with a QAction.
The QAction works fine when triggered by a write parameter (1001) within the virtual element.
The virtual element has 4 variables (sw1v,sw2v,sw3,sw4) copied from another element.
I want to run the QAction when any of these 4 virtual parameters changes
If I include these virtual parameters in the triggers I get the following errors and a thread error and restart on the agent.
It seems that until the values of the virtual parameters have been copied across to the virtual element the action fails. Is there a way of stopping this happening? I tried to catch it in the QAction without success.
Element Log#####################################
2024/06/01 20:46:29.615|SLProtocol - 1616 - TEL4 Virtual Element|46816|CQAction::Run|ERR|-1|QAction [1] triggered by [pid=132/idx=-1/pk=/user=Scripting-engine] failed. (0x800700A4)
Input: new = <NULL>
Input: old = <NULL>
Input: extra = <NULL>
2024/06/01 20:46:29.616|SLProtocol - 1616 - TEL4 Virtual Element|46816|CQAction::Run|ERR|-1|QAction [1] triggered by [pid=133/idx=-1/pk=/user=Scripting-engine] failed. (0x800700A4)
Input: new = <NULL>
Input: old = <NULL>
Input: extra = <NULL>
2024/06/01 20:46:29.618|SLProtocol - 1616 - TEL4 Virtual Element|46816|CQAction::Run|ERR|-1|QAction [1] triggered by [pid=131/idx=-1/pk=/user=Scripting-engine] failed. (0x800700A4)
Input: new = <NULL>
Input: old = <NULL>
Input: extra = <NULL>
2024/06/01 20:46:29.620|SLProtocol - 1616 - TEL4 Virtual Element|46816|CQAction::Run|ERR|-1|QAction [1] triggered by [pid=134/idx=-1/pk=/user=Scripting-engine] failed. (0x800700A4)
Input: new = <NULL>
Input: old = <NULL>
Input: extra = <NULL>
2024/06/01 20:46:29.620|SLManagedScripting.exe|ManagedInterop|CRU|0|3265|QA1Mark Smith - Protocol Tests
2024/06/01 20:46:29.622|SLProtocol - 1616 - TEL4 Virtual Element|46816|CQAction::Run|ERR|-1|QAction [1] triggered by [pid=132/idx=-1/pk=/user=Scripting-engine] failed. (0x800700A4)
Input: new = <NULL>
Input: old = <NULL>
Input: extra = <NULL>
2024/06/01 20:46:29.622|SLProtocol - 1616 - TEL4 Virtual Element|46816|CQAction::Run|ERR|-1|QAction [1] triggered by [pid=133/idx=-1/pk=/user=Scripting-engine] failed. (0x800700A4)
Input: new = <NULL>
Input: old = <NULL>
Input: extra = <NULL>
2024/06/01 20:46:29.623|SLProtocol - 1616 - TEL4 Virtual Element|46816|CQAction::Run|ERR|-1|QAction [1] triggered by [pid=131/idx=-1/pk=/user=Scripting-engine] failed. (0x800700A4)
Input: new = <NULL>
Input: old = <NULL>
Input: extra = <NULL>
2024/06/01 20:46:29.624|SLProtocol - 1616 - TEL4 Virtual Element|46384|CQAction::Run|ERR|-1|QAction [1] triggered by [pid=134/idx=-1/pk=/user=Scripting-engine] failed. (0x800700A4)
Input: new = <NULL>
Input: old = <NULL>
Input: extra = <NULL>
2024/06/01 20:46:29.624|SLManagedScripting.exe|ManagedInterop|CRU|0|3266|QA1Mark Smith - Protocol Tests
Virtual Parameter########################################
<Param id="121" trending="false">
<Name>SW1v_Pos</Name>
<Description>SW1v_Pos</Description>
<Information>
<Subtext>Sw1v_Pos</Subtext>
</Information>
<Type virtual="destination">read</Type>
<Interprete>
<RawType>numeric text</RawType>
<LengthType>next param</LengthType>
<Type>double</Type>
</Interprete>
QAction########################################
<QActions>
<QAction id="1" name="TX Path Calcs" encoding="csharp" triggers="1001">
<!-- 1001 (screen lock) useful for testing only -->
<![CDATA[
using System;
using Skyline.DataMiner.Scripting;
public class QAction
{
public static void Run(SLProtocol protocol)
{
String logMsg = "Mark Smith - Protocol Tests - ";
protocol.Log(logMsg + "Starting" , LogType.Allways, LogLevel.NoLogging);
bool invalidParam = false;
int triggerParam = protocol.GetTriggerParameter();
if (protocol.IsEmpty(triggerParam)){
invalidParam = true;
}
if (protocol.IsEmpty(Parameter.sw1v_pos)){
invalidParam = true;
}
if (protocol.IsEmpty(Parameter.sw2v_pos)){
invalidParam = true;
}
if (protocol.IsEmpty(Parameter.sw3_pos)){
invalidParam = true;
}
if (protocol.IsEmpty(Parameter.sw4_pos)){
invalidParam = true;
}
if (invalidParam){
protocol.Log(logMsg + "Unitialised parameter - aborting - Trigger Parameter:- " + triggerParam , LogType.Allways, LogLevel.NoLogging);
return;
}else{
protocol.Log(logMsg + "Running - Trigger Parameter:- " + triggerParam , LogType.Allways, LogLevel.NoLogging);
}
int sw1v = Convert.ToInt32(protocol.GetParameter(Parameter.sw1v_pos));
int sw2v = Convert.ToInt32(protocol.GetParameter(Parameter.sw2v_pos));
int sw3 = Convert.ToInt32(protocol.GetParameter(Parameter.sw3_pos));
int sw4 = Convert.ToInt32(protocol.GetParameter(Parameter.sw4_pos));
// live values:- 0=Unknown, 1=Dead, 2=Live
int chain1live= 0;
int chain1slive= 0;
int chain1or1slive= 0;
int chain2live= 0;
int chain2slive= 0;
int chain2or2slive= 0;
switch(sw3){
case 1:
chain1or1slive= 2;
switch(sw1v){
case 1:
chain1live = 2;
chain1slive = 1;
break;
case 2:
chain1live = 1;
chain1slive = 2;
break;
}
break;
case 2:
chain1live= 1;
chain1slive= 1;
chain1or1slive= 1;
break;
}
switch(sw4){
case 1:
chain2or2slive= 2;
switch(sw2v){
case 1:
chain2live = 2;
chain2slive = 1;
break;
case 2:
chain2live = 1;
chain2slive = 2;
break;
}
break;
case 2:
chain2live= 1;
chain2slive= 1;
chain2or2slive= 1;
break;
}
protocol.SetParameter(Parameter.chain1_live,chain1live);
protocol.SetParameter(Parameter.chain1s_live,chain1slive);
protocol.SetParameter(Parameter.chain1or1s_live,chain1or1slive);
protocol.SetParameter(Parameter.chain2_live,chain2live);
protocol.SetParameter(Parameter.chain2s_live,chain2slive);
protocol.SetParameter(Parameter.chain2or2s_live,chain2or2slive);
protocol.Log(logMsg + "Exit OK" , LogType.Allways, LogLevel.NoLogging);
return;
}
}]]>
</QAction>
##############################################
Hi,
The error 0x800700A4 means "No more threads can be created in the system". This points that SLScripting, which is a 32-bit process has reached its maximum memory limit of 4GB.
As there is mentioned that the wrong parameter was set to trigger on the QAction and else when triggering on a different parameter the issue is not occurring, my best guess would be that there was an infinite trigger loop executed here. E.g. parameter 132 triggers to let the QAction go off, this performs a set on parameter 132, because of this change a new QAction that triggers on 132 goes off again while the previous one is still being executed:
QAction triggers 131
SetParameter 131
QAction triggers 131
SetParameter 131
QAction triggers 131
SetParameter 131
.....
Because of this infinite number of QActions being started, it eventually reaches the maximum memory of SLScripting, which causes error 0x800700A4.
Note that above was just an example on how it could explain the problem, as I don't know the real parameter ids of the parameters that were being set e.g. Parameter.chain1_live,chain1live, nor do I know what was defined in the triggers attribute on the QAction (I can see that it was at least triggers="131;132;133;134")
Another explanation could be that SLScripting was already running towards the memory limit and executing this one QAction was too much, but that info is present on the monitoring of the memory of the SLScipting process to see if the value before executing the QAction is much lower than the 4GB limit.
Regards,
Thanks Lauurens for such a full explanation. Solved!
Looking into this again I realise I might have been trying to trigger on the wrong virtual parameter. parameter. Is that what the “NULL” errors are trying to tell me?
And would repeated script fails cause a thread error.
Thanks,
Mark.