Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3047 Fixed multiple generation of event with the same error in Meta… #3048

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class MetaDataSourceRT extends DataSourceRT {
public static final int EVENT_TYPE_CONTEXT_POINT_DISABLED = 1;
public static final int EVENT_TYPE_SCRIPT_ERROR = 2;
public static final int EVENT_TYPE_RESULT_TYPE_ERROR = 3;
public static final int EVENT_TYPE_RECURSIVE_ERROR = 4;

private final List<DataPointRT> points = new CopyOnWriteArrayList<DataPointRT>();
@Deprecated(since = "2.8.0")
Expand Down Expand Up @@ -111,6 +112,15 @@ public void raiseScriptError(long runtime, DataPointRT dataPoint, LocalizableMes
.getVO().getName(), message), dataPoint);
}

public void raiseRecursiveError(long runtime, DataPointRT dataPoint, LocalizableMessage message) {
if(isNone(EVENT_TYPE_RECURSIVE_ERROR)) {
setUnreliableDataPoint(dataPoint);
return;
}
raiseEvent(EVENT_TYPE_RECURSIVE_ERROR, runtime, true, new LocalizableMessage("event.meta.recursiveError", dataPoint
.getVO().getName(), message), dataPoint);
}

public void raiseContextError(long runtime, DataPointRT dataPoint, LocalizableMessage message) {
if(isNone(EVENT_TYPE_CONTEXT_POINT_DISABLED)) {
setUnreliableDataPoint(dataPoint);
Expand All @@ -127,6 +137,14 @@ public void returnToNormalScript(long runtime, DataPointRT dataPoint) {
returnToNormal(EVENT_TYPE_SCRIPT_ERROR, runtime, dataPoint);
}

public void returnToNormalRecursive(long runtime, DataPointRT dataPoint) {
if(isNone(EVENT_TYPE_RECURSIVE_ERROR)) {
resetUnreliableDataPoint(dataPoint);
return;
}
returnToNormal(EVENT_TYPE_RECURSIVE_ERROR, runtime, dataPoint);
}

public void returnToNormalContext(long runtime, DataPointRT dataPoint) {
if(isNone(EVENT_TYPE_CONTEXT_POINT_DISABLED)) {
resetUnreliableDataPoint(dataPoint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,13 @@ private void execute(long runtime, List<Integer> sourceIds, boolean initializeMo
}

if (count > MAX_RECURSION) {
handleScriptError(runtime, dataPoint, new LocalizableMessage("event.meta.recursionFailure"));
handleRecursiveError(runtime, dataPoint, new LocalizableMessage("event.meta.recursionFailure"));
String msg = MessageFormat.format("Recursion failure: exceeded MAX_RECURSION: expected <= {0} but was {1}, Context: {2}",
String.valueOf(MAX_RECURSION), count, generateContext(dataPoint, dataSource));
LOG.warn(msg);
return;
} else {
returnToNormal(runtime, dataPoint);
returnToNormalRecursive(runtime, dataPoint);
}

sourceIds.add(dataPoint.getId());
Expand Down Expand Up @@ -370,6 +370,10 @@ protected void doUpdate(PointValueTime pvt, DataPointRT dataPoint) {
returnToNormal(System.currentTimeMillis(), dataPoint);
}

protected void handleRecursiveError(long runtime, DataPointRT dataPoint, LocalizableMessage message) {
dataSource.raiseRecursiveError(runtime, dataPoint, message);
}

protected void handleScriptError(long runtime, DataPointRT dataPoint, LocalizableMessage message) {
dataSource.raiseScriptError(runtime, dataPoint, message);
}
Expand All @@ -382,6 +386,10 @@ protected void returnToNormal(long runtime, DataPointRT dataPoint) {
dataSource.returnToNormalScript(runtime, dataPoint);
}

protected void returnToNormalRecursive(long runtime, DataPointRT dataPoint) {
dataSource.returnToNormalRecursive(runtime, dataPoint);
}

protected void returnToNormalContext(long runtime, DataPointRT dataPoint) {
dataSource.returnToNormalContext(runtime, dataPoint);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,16 @@ protected void addEventTypes(List<EventTypeVO> ets) {
new LocalizableMessage("event.ds.scriptError")));
ets.add(createEventType(MetaDataSourceRT.EVENT_TYPE_RESULT_TYPE_ERROR, new LocalizableMessage(
"event.ds.resultType")));
ets.add(createEventType(MetaDataSourceRT.EVENT_TYPE_RECURSIVE_ERROR, new LocalizableMessage(
"event.ds.recursiveError")));
}

private static final ExportCodes EVENT_CODES = new ExportCodes();
static {
EVENT_CODES.addElement(MetaDataSourceRT.EVENT_TYPE_CONTEXT_POINT_DISABLED, "CONTEXT_POINT_DISABLED");
EVENT_CODES.addElement(MetaDataSourceRT.EVENT_TYPE_SCRIPT_ERROR, "SCRIPT_ERROR");
EVENT_CODES.addElement(MetaDataSourceRT.EVENT_TYPE_RESULT_TYPE_ERROR, "RESULT_TYPE_ERROR");
EVENT_CODES.addElement(MetaDataSourceRT.EVENT_TYPE_RECURSIVE_ERROR, "RECURSIVE_ERROR");
}

@Override
Expand Down
37 changes: 28 additions & 9 deletions test/messages_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3323,29 +3323,48 @@ user.view.hideShortcutDisableFullScreen=Hide shortcut to disable full screen
user.view.forceAdminTitle=The function is enforced by the Admin
validate.1to255=Must be between 1 and 255 inclusive
systemsettings.event.pendingLimit=Event Pending Limit
systemsettings.event.pendingCacheEnabled=Enabled Event Pending Cache
systemsettings.event.pendingCacheEnabled=Event Pending Cache Enabled
annotation.unknown=Unknown
event.auto.acknowledge=Automatic acknowledge
systemsettings.workitems.reporting.enabled=Work items reporting enabled
systemsettings.workitems.reporting.itemspersecond.enabled=Items per second reporting enabled
systemsettings.workitems.reporting.itemspersecond.limit=Items per second reporting limit
systemsettings.threads.name.additional.length=Thread name length
systemsettings.workitems.reporting.enabled=Work Items Reporting Enabled
systemsettings.workitems.reporting.itemspersecond.enabled=Items Per Second Reporting Enabled
systemsettings.workitems.reporting.itemspersecond.limit=Items Per Second Reporting Limit
systemsettings.threads.name.additional.length=Thread Name Length
common.addPoint=Add point
systemsettings.webresource.uploads.path=Uploads images path
systemsettings.webresource.graphics.path=Graphics images path
systemsettings.webresource.uploads.path=Uploads Images Path
systemsettings.webresource.graphics.path=Graphics Images Path
systemsettings.webresource.uploads.path.wrong=Uploaded images save path must end with "uploads" or "uploads{0}"
systemsettings.webresource.graphics.path.wrong=Graphics images path must end with "graphics" or "graphics{0}"
event.ds.monitorWrite=Monitor write exception
dsEdit.mbus.correctionFactor=Correction factor
annotation.api=REST API
pointEdit.buttons.note.prefix=Hinweis:
sql.warning.prefix=Achtung:
views.noViews.prefix=jetzt.
annotation.api=REST API
dsEdit.sql.statementLimit=Statement limit
dsEdit.sql.statementLimit.warning=Setting the value 0 in the Statement limit field means there is no limit for the select query, which may lead to a serious application failure due to filling up the memory needed for the application to run. Do you confirm setting Statement limit equals 0?
event.sms.failure=Failed to send sms titled "{0}" to "{1}". Message: "{2}"
event.script.failure=Failed execute script: "{0}", Message: "{1}"
event.system.sms=Sms send failure
event.system.script=Script event handler failure
validate.valueRestored=Previous value restored
validate.invalidVariable=Invalid variable: {0}
validate.invalidVariable=Invalid variable: {0}
events.assigneeByUser=- {0}
events.assign=Assign
events.unassign=Unassign
events.unassignedBy=Unassigned {0} by {1} for {2}
events.assignedBy=Assigned by {0} for {1}
common.assignee=Assignee
event.system.assigned=Assigned Event
event.system.unassigned=Unassigned Event
event.assign.enabled=Event Assign Enabled
viewEdit.graphic.hideAssigneeColumn=Hide Assignee Column
systemsettings.top.description.prefix = Top description prefix
systemsettings.top.description = Top description
header.imageSets=Image sets
header.dynamicImages=Dynamic images
systemSettings.customCssSaved=Custom Css has been saved
systemSettings.invalidCustomCss=Invalid custom CSS
systemsettings.reports.dataPointExtendedNameLengthLimit=Point name length limit in reports
event.ds.recursiveError=Recursive Error
event.meta.recursiveError=Recursive error in point "{0}": {1}
37 changes: 28 additions & 9 deletions test/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3326,29 +3326,48 @@ user.view.hideShortcutDisableFullScreen=Hide shortcut to disable full screen
user.view.forceAdminTitle=The function is enforced by the Admin
validate.1to255=Must be between 1 and 255 inclusive
systemsettings.event.pendingLimit=Event Pending Limit
systemsettings.event.pendingCacheEnabled=Enabled Event Pending Cache
systemsettings.event.pendingCacheEnabled=Event Pending Cache Enabled
annotation.unknown=Unknown
event.auto.acknowledge=Automatic acknowledge
systemsettings.workitems.reporting.enabled=Work items reporting enabled
systemsettings.workitems.reporting.itemspersecond.enabled=Items per second reporting enabled
systemsettings.workitems.reporting.itemspersecond.limit=Items per second reporting limit
systemsettings.threads.name.additional.length=Thread name length
systemsettings.workitems.reporting.enabled=Work Items Reporting Enabled
systemsettings.workitems.reporting.itemspersecond.enabled=Items Per Second Reporting Enabled
systemsettings.workitems.reporting.itemspersecond.limit=Items Per Second Reporting Limit
systemsettings.threads.name.additional.length=Thread Name Length
common.addPoint=Add point
systemsettings.webresource.uploads.path=Uploads images path
systemsettings.webresource.graphics.path=Graphics images path
systemsettings.webresource.uploads.path=Uploads Images Path
systemsettings.webresource.graphics.path=Graphics Images Path
systemsettings.webresource.uploads.path.wrong=Uploaded images save path must end with "uploads" or "uploads{0}"
systemsettings.webresource.graphics.path.wrong=Graphics images path must end with "graphics" or "graphics{0}"
event.ds.monitorWrite=Monitor write exception
dsEdit.mbus.correctionFactor=Correction factor
annotation.api=REST API
pointEdit.buttons.note.prefix=Note:
sql.warning.prefix=Warning:
views.noViews.prefix=now.
annotation.api=REST API
dsEdit.sql.statementLimit=Statement limit
dsEdit.sql.statementLimit.warning=Setting the value 0 in the Statement limit field means there is no limit for the select query, which may lead to a serious application failure due to filling up the memory needed for the application to run. Do you confirm setting Statement limit equals 0?
event.sms.failure=Failed to send sms titled "{0}" to "{1}". Message: "{2}"
event.script.failure=Failed execute script: "{0}", Message: "{1}"
event.system.sms=Sms send failure
event.system.script=Script event handler failure
validate.valueRestored=Previous value restored
validate.invalidVariable=Invalid variable: {0}
validate.invalidVariable=Invalid variable: {0}
events.assigneeByUser=- {0}
events.assign=Assign
events.unassign=Unassign
events.unassignedBy=Unassigned {0} by {1} for {2}
events.assignedBy=Assigned by {0} for {1}
common.assignee=Assignee
event.system.assigned=Assigned Event
event.system.unassigned=Unassigned Event
event.assign.enabled=Event Assign enabled
viewEdit.graphic.hideAssigneeColumn=Hide Assignee column
systemsettings.top.description.prefix = Top description prefix
systemsettings.top.description = Top description
header.imageSets=Image sets
header.dynamicImages=Dynamic images
systemSettings.customCssSaved=Custom Css has been saved
systemSettings.invalidCustomCss=Invalid custom CSS
systemsettings.reports.dataPointExtendedNameLengthLimit=Point name length limit in reports
event.ds.recursiveError=Recursive Error
event.meta.recursiveError=Recursive error in point "{0}": {1}
37 changes: 28 additions & 9 deletions test/messages_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3366,29 +3366,48 @@ user.view.hideShortcutDisableFullScreen=Hide shortcut to disable full screen
user.view.forceAdminTitle=The function is enforced by the Admin
validate.1to255=Must be between 1 and 255 inclusive
systemsettings.event.pendingLimit=Event Pending Limit
systemsettings.event.pendingCacheEnabled=Enabled Event Pending Cache
systemsettings.event.pendingCacheEnabled=Event Pending Cache Enabled
annotation.unknown=Unknown
event.auto.acknowledge=Automatic acknowledge
systemsettings.workitems.reporting.enabled=Work items reporting enabled
systemsettings.workitems.reporting.itemspersecond.enabled=Items per second reporting enabled
systemsettings.workitems.reporting.itemspersecond.limit=Items per second reporting limit
systemsettings.threads.name.additional.length=Thread name length
systemsettings.workitems.reporting.enabled=Work Items Reporting Enabled
systemsettings.workitems.reporting.itemspersecond.enabled=Items Per Second Reporting Enabled
systemsettings.workitems.reporting.itemspersecond.limit=Items Per Second Reporting Limit
systemsettings.threads.name.additional.length=Thread Name Length
common.addPoint=Add point
systemsettings.webresource.uploads.path=Uploads images path
systemsettings.webresource.graphics.path=Graphics images path
systemsettings.webresource.uploads.path=Uploads Images Path
systemsettings.webresource.graphics.path=Graphics Images Path
systemsettings.webresource.uploads.path.wrong=Uploaded images save path must end with "uploads" or "uploads{0}"
systemsettings.webresource.graphics.path.wrong=Graphics images path must end with "graphics" or "graphics{0}"
event.ds.monitorWrite=Monitor write exception
dsEdit.mbus.correctionFactor=Correction factor
annotation.api=REST API
pointEdit.buttons.note.prefix=Nota:
sql.warning.prefix=Advertencia:
views.noViews.prefix=nueva.
annotation.api=REST API
dsEdit.sql.statementLimit=Statement limit
dsEdit.sql.statementLimit.warning=Setting the value 0 in the Statement limit field means there is no limit for the select query, which may lead to a serious application failure due to filling up the memory needed for the application to run. Do you confirm setting Statement limit equals 0?
event.sms.failure=Failed to send sms titled "{0}" to "{1}". Message: "{2}"
event.script.failure=Failed execute script: "{0}", Message: "{1}"
event.system.sms=Sms send failure
event.system.script=Script event handler failure
validate.valueRestored=Previous value restored
validate.invalidVariable=Invalid variable: {0}
validate.invalidVariable=Invalid variable: {0}
events.assigneeByUser=- {0}
events.assign=Assign
events.unassign=Unassign
events.unassignedBy=Unassigned {0} by {1} for {2}
events.assignedBy=Assigned by {0} for {1}
common.assignee=Assignee
event.system.assigned=Assigned Event
event.system.unassigned=Unassigned Event
event.assign.enabled=Event Assign enabled
viewEdit.graphic.hideAssigneeColumn=Hide Assignee column
systemsettings.top.description.prefix = Top description prefix
systemsettings.top.description = Top description
header.imageSets=Image sets
header.dynamicImages=Dynamic images
systemSettings.customCssSaved=Custom Css has been saved
systemSettings.invalidCustomCss=Invalid custom CSS
systemsettings.reports.dataPointExtendedNameLengthLimit=Point name length limit in reports
event.ds.recursiveError=Recursive Error
event.meta.recursiveError=Recursive error in point "{0}": {1}
37 changes: 28 additions & 9 deletions test/messages_fi.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3451,29 +3451,48 @@ user.view.hideShortcutDisableFullScreen=Hide shortcut to disable full screen
user.view.forceAdminTitle=The function is enforced by the Admin
validate.1to255=Must be between 1 and 255 inclusive
systemsettings.event.pendingLimit=Event Pending Limit
systemsettings.event.pendingCacheEnabled=Enabled Event Pending Cache
systemsettings.event.pendingCacheEnabled=Event Pending Cache Enabled
annotation.unknown=Unknown
event.auto.acknowledge=Automatic acknowledge
systemsettings.workitems.reporting.enabled=Work items reporting enabled
systemsettings.workitems.reporting.itemspersecond.enabled=Items per second reporting enabled
systemsettings.workitems.reporting.itemspersecond.limit=Items per second reporting limit
systemsettings.threads.name.additional.length=Thread name length
systemsettings.workitems.reporting.enabled=Work Items Reporting Enabled
systemsettings.workitems.reporting.itemspersecond.enabled=Items Per Second Reporting Enabled
systemsettings.workitems.reporting.itemspersecond.limit=Items Per Second Reporting Limit
systemsettings.threads.name.additional.length=Thread Name Length
common.addPoint=Add point
systemsettings.webresource.uploads.path=Uploads images path
systemsettings.webresource.graphics.path=Graphics images path
systemsettings.webresource.uploads.path=Uploads Images Path
systemsettings.webresource.graphics.path=Graphics Images Path
systemsettings.webresource.uploads.path.wrong=Uploaded images save path must end with "uploads" or "uploads{0}"
systemsettings.webresource.graphics.path.wrong=Graphics images path must end with "graphics" or "graphics{0}"
event.ds.monitorWrite=Monitor write exception
dsEdit.mbus.correctionFactor=Correction factor
annotation.api=REST API
pointEdit.buttons.note.prefix=Huom:
sql.warning.prefix=Varoitus:
views.noViews.prefix=nyt.
annotation.api=REST API
dsEdit.sql.statementLimit=Statement limit
dsEdit.sql.statementLimit.warning=Setting the value 0 in the Statement limit field means there is no limit for the select query, which may lead to a serious application failure due to filling up the memory needed for the application to run. Do you confirm setting Statement limit equals 0?
event.sms.failure=Failed to send sms titled "{0}" to "{1}". Message: "{2}"
event.script.failure=Failed execute script: "{0}", Message: "{1}"
event.system.sms=Sms send failure
event.system.script=Script event handler failure
validate.valueRestored=Previous value restored
validate.invalidVariable=Invalid variable: {0}
validate.invalidVariable=Invalid variable: {0}
events.assigneeByUser=- {0}
events.assign=Assign
events.unassign=Unassign
events.unassignedBy=Unassigned {0} by {1} for {2}
events.assignedBy=Assigned by {0} for {1}
common.assignee=Assignee
event.system.assigned=Assigned Event
event.system.unassigned=Unassigned Event
event.assign.enabled=Event Assign enabled
viewEdit.graphic.hideAssigneeColumn=Hide Assignee column
systemsettings.top.description.prefix = Top description prefix
systemsettings.top.description = Top description
header.imageSets=Image sets
header.dynamicImages=Dynamic images
systemSettings.customCssSaved=Custom Css has been saved
systemSettings.invalidCustomCss=Invalid custom CSS
systemsettings.reports.dataPointExtendedNameLengthLimit=Point name length limit in reports
event.ds.recursiveError=Recursive Error
event.meta.recursiveError=Recursive error in point "{0}": {1}
Loading
Loading