Skip to content

Cyclic nested end-to-end flows create cyclic instance graphs 馃#2987

Description

@lwrage

Summary

Cyclic references between nested end-to-end flows are treated as successfully instantiated and can create cyclic instance graphs or unbounded recursion.

instantiateEndToEndFlow inserts the declarative flow into ete2info before processing its segments. processEndToEndFlow uses only containsKey to decide that a referenced flow is already instantiated. A reference back to a flow currently being processed therefore reuses its incomplete instance as if it were complete.

There is already a TODO in this path to detect cyclic dependencies between end-to-end flows.

Reproduction

Declare two end-to-end flows where a contains b and b contains a, and reference one of them from another flow or instantiate the containing implementation.

The instantiated model can contain EndToEndFlowInstance objects that recursively contain each other. Code that follows the first or last nested flow element can then recurse indefinitely or fail with a stack overflow.

Expected behavior

Instantiation should distinguish in-progress flows from completed cached flows, detect the cycle, report an instantiation diagnostic, and avoid retaining a cyclic or incomplete end-to-end flow instance graph.

Relevant code

core/org.osate.aadl2.instantiation/src/org/osate/aadl2/instantiation/CreateEndToEndFlowsSwitch.java, methods instantiateEndToEndFlow and processEndToEndFlow.

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions