ST6RI-939 Fix StackOverflow when loading a ResourceSet#770
Open
AxelRICHARD wants to merge 1 commit into
Open
Conversation
Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
00acc2f to
2a8e96c
Compare
Contributor
Author
|
Hello @seidewitz do you need something else for this pull request? If no, can I set it as "Ready for review"? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix a StackOverflow when loading a ResourceSet containing TransitionUsage elements.
Context
Loading a SysML-XMI ResourceSet can trigger a StackOverflowError when derived properties are evaluated on TransitionUsage elements.
The recursion involves the derived transition properties and the implicit member computation performed by TransitionUsageAdapter, especially around:
Observed Behavior
The application fails with a recursive stack similar to:
SysML-Level Explanation
In SysML, TransitionUsage::source is a derived property. It is computed from sourceFeature(), which identifies the feature used as the source of the transition succession.
At the same time, TransitionUsageAdapter may add implicit members required by transition semantics, such as:
The issue is that this implicit member computation is not reentrant-safe.
Recursion Cycle
The problematic cycle is:
This leads to unbounded recursion and eventually a StackOverflowError.
Typical Trigger
The issue can occur when a TransitionUsage has parameters, but its succession-related implicit members are not fully available at the time source is evaluated.
In that state, computeTransitionLinkConnectors() attempts to compute source-related binding connectors and reads transition.getSource(), which re-enters the same implicit member computation.
Expected Behavior
Evaluating derived properties of TransitionUsage should be stable and reentrant-safe.
Reading TransitionUsage::source should not cause unbounded recursion, even if implicit transition members are still being computed.
Actual Behavior
Reading TransitionUsage::source can recursively trigger transition implicit member computation, which reads source again and causes a StackOverflowError.