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

Fixed StackOverflowError for Cyclic Dependency in Meta Data Source #3088

Closed
Limraj opened this issue Feb 14, 2025 · 0 comments
Closed

Fixed StackOverflowError for Cyclic Dependency in Meta Data Source #3088

Limraj opened this issue Feb 14, 2025 · 0 comments
Assignees
Labels
Milestone

Comments

@Limraj
Copy link
Collaborator

Limraj commented Feb 14, 2025

Description
In issue #3055, a validation has been added that makes it impossible to save a point with a cyclic dependency, but in the old configuration such a dependency could have been saved earlier and with such a dependency, a StackOverflowError error occurred when stopping and starting the point.

To Reproduce
Steps to reproduce the behavior:

Case 1:

  1. Login as admin;
  2. Import config from cyclic_conf.txt;
  3. Enabled/Disabled point 'vds_1_vdp_1' then StackOverflowError in tomcat/logs/mango.log;
java.lang.StackOverflowError: null
	at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
	at org.apache.commons.logging.LogFactory.getContextClassLoaderInternal(LogFactory.java:808) ~[commons-logging-1.2.jar:1.2]
	at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:419) ~[commons-logging-1.2.jar:1.2]
	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:655) ~[commons-logging-1.2.jar:1.2]
	at com.serotonin.mango.rt.event.type.DataSourceEventType.<init>(DataSourceEventType.java:41) ~[classes/:?]
	at com.serotonin.mango.rt.event.type.DataSourcePointEventType.<init>(DataSourcePointEventType.java:46) ~[classes/:?]
	at com.serotonin.mango.rt.dataSource.DataSourceRT.getDataSourceEventType(DataSourceRT.java:193) ~[classes/:?]
	at com.serotonin.mango.rt.dataSource.DataSourceRT._raiseEvent(DataSourceRT.java:174) ~[classes/:?]
	at com.serotonin.mango.rt.dataSource.DataSourceRT._raiseEvent(DataSourceRT.java:170) ~[classes/:?]
	at com.serotonin.mango.rt.dataSource.DataSourceRT.raiseEvent(DataSourceRT.java:203) ~[classes/:?]
	at com.serotonin.mango.rt.dataSource.meta.MetaDataSourceRT.raiseContextError(MetaDataSourceRT.java:129) ~[classes/:?]
	at com.serotonin.mango.rt.dataSource.meta.ScriptExecutor.convertContext(ScriptExecutor.java:95) ~[classes/:?]
	at com.serotonin.mango.rt.dataSource.meta.MetaPointLocatorRT.createContext(MetaPointLocatorRT.java:333) ~[classes/:?]
	at com.serotonin.mango.rt.dataSource.meta.MetaPointLocatorRT.pointTerminated(MetaPointLocatorRT.java:198) ~[classes/:?]

Case 2:

  1. Login as admin;
  2. Created OPC UA Data Source;
  3. Find nodes;

Case 3:

  1. Login as admin;
  2. Created Virtual Data Source as virtual_1(Update: 1s, enabled) with point as 'virutal_1 - vdp_1' (Numeric, Increment, enabled);
  3. Created three Meta Data Source as: meta_1, meta_2, meta_3 (all enabled) with points:
  • 'meta_1 - mdp_1' -> data type: Numeric, Add context 'virtual_1 - vdp_1' as p1, Script: 'return p1.value', enabled;
  • 'meta_2 - mdp_1' -> data type: Numeric, Add context 'meta_1 - mdp_1' as p1, Script: 'return p1.value', enabled;
  • 'meta_3 - mdp_1' ->data type: Numeric, Add context 'meta_2 - mdp_1' as p1, Script: 'return p1.value', enabled;
  1. Then there are no such errors in the logs::
    ERROR 2025-02-14T22:51:24,475 (com.serotonin.mango.rt.dataSource.meta.ScriptExecutor.convertContext:81) - Error DataPointRT null java.lang.Exception: key:206 value:p1 from:datapoint: meta_3 - mdp_1 (id: 208, xid: DP_193203, dataSourceId: 69, dataSourceXid: DS_328121, dataSourceName: meta_3)

Case 4:

  1. Login as admin;
  2. Created Virtual Data Source as virtual_1(Update: 1s, enabled) with point as 'virutal_1 - vdp_1' (Numeric, Increment, enabled);
  3. Created three Meta Data Source as: meta_1, meta_2, meta_3 (all enabled) with points:
  • 'meta_1 - mdp_1' -> data type: Numeric, Add context 'virtual_1 - vdp_1' as p1, Script: 'return p1.value', enabled;
  • 'meta_2 - mdp_1' -> data type: Numeric, Add context 'meta_1 - mdp_1' as p1, Script: 'return p1.value', enabled;
  • 'meta_3 - mdp_1' ->data type: Numeric, Add context 'meta_2 - mdp_1' as p1, Script: 'return p1.value', enabled;
  1. Disabled 'virtual_1 - vdp_1' then all Meta Data Points with 'Point value may not be reliable';

Spec:

  • Scada-LTS Version 2.8.0

Additional context
cyclic_conf.txt

@Limraj Limraj added the bug label Feb 14, 2025
@Limraj Limraj added this to the 2.8.0 milestone Feb 14, 2025
@Limraj Limraj self-assigned this Feb 14, 2025
Limraj added a commit that referenced this issue Feb 14, 2025
…rce:

- Added validate cyclic dependency in methods: MetaPointLocatorRT.pointInitialized, MetaPointLocatorRT.pointTerminated;
- User Login Event set state 'Return To Normal' after logout user;
- Refactoring for recursive actions: SearchCyclicDependencyAction, SetUnreliableDataPointsAction, CollectMetaDataPointFromContextAction, SearchOpcUaNodesAction;
- Added param 'scadalts.validation.search-cyclic-depth' to env.properties;
- Invoke mangoContextListener.contextInitialized is not initialized mangoContextListener;
- Invoke 'Return To Normal' again only if changed unreliable;
- Added test cases in: CyclicDependencyValidationUtilsTest, DataPointUnreliableUtilsTest;
- Optimized test, closed timer, reduce number threads 'Serotonin Timer': DataPointUnreliableUtilsTest;
Limraj added a commit that referenced this issue Feb 18, 2025
…rce:

- junit use fork join pool with 2 threads;
- correceted name from nodesFinder to searchNodes variable in OpcUaMaster.browse;
Limraj added a commit that referenced this issue Feb 18, 2025
…Error_for_Cyclic_Dependency_in_Meta_Data_Source

#3088 Fixed StackOverflowError for Cyclic Dependency in Meta Data Sou…
@Limraj Limraj closed this as completed Feb 18, 2025
Limraj added a commit that referenced this issue Feb 19, 2025
…rce:

- Corrected actions: CollectMetaDataPointFromContextAction, SearchCyclicDependencyAction;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant