Skip to content

ST6RI-939 Fix StackOverflow when loading a ResourceSet#770

Open
AxelRICHARD wants to merge 1 commit into
masterfrom
ST6RI-939
Open

ST6RI-939 Fix StackOverflow when loading a ResourceSet#770
AxelRICHARD wants to merge 1 commit into
masterfrom
ST6RI-939

Conversation

@AxelRICHARD

@AxelRICHARD AxelRICHARD commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

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:

  • TransitionUsage::source
  • TransitionUsage::sourceFeature()
  • TransitionUsage::succession
  • implicit transition members and binding connectors

Observed Behavior

The application fails with a recursive stack similar to:

java.lang.StackOverflowError
  at org.omg.sysml.delegate.setting.TransitionUsage_source_SettingDelegate.basicGet(...)
  at org.omg.sysml.lang.sysml.impl.TransitionUsageImpl.getSource(...)
  at org.omg.sysml.adapter.TransitionUsageAdapter.computeTransitionLinkConnectors(...)
  at org.omg.sysml.adapter.TransitionUsageAdapter.addAdditionalMembers(...)
  at org.omg.sysml.util.NamespaceUtil.addAdditionalMembersTo(...)
  at org.omg.sysml.util.UsageUtil.getSourceFeatureOf(...)
  at org.omg.sysml.lang.sysml.impl.TransitionUsageImpl.sourceFeature(...)
  at org.omg.sysml.delegate.setting.TransitionUsage_source_SettingDelegate.basicGet(...)
  ...

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 implicit source member;
  • transition link connectors;
  • binding connectors between the succession, the transition link, and parameters.

The issue is that this implicit member computation is not reentrant-safe.

Recursion Cycle

The problematic cycle is:

  1. Code reads transition.getSource().
  2. This evaluates the derived property TransitionUsage::source.
  3. The derived property calls transition.sourceFeature().
  4. sourceFeature() delegates to UsageUtil.getSourceFeatureOf(transition).
  5. UsageUtil.getSourceFeatureOf(...) calls NamespaceUtil.addAdditionalMembersTo(transition).
  6. TransitionUsageAdapter.addAdditionalMembers() calls computeTransitionLinkConnectors().
  7. computeTransitionLinkConnectors() reads transition.getSource().
  8. The same cycle starts again.

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.

Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
@AxelRICHARD AxelRICHARD added the bug Something isn't working label Jun 17, 2026
@AxelRICHARD AxelRICHARD added this to the 2026-05 milestone Jun 17, 2026
@AxelRICHARD AxelRICHARD marked this pull request as ready for review June 17, 2026 07:56
@seidewitz seidewitz removed this from the 2026-05 milestone Jun 17, 2026
@seidewitz seidewitz marked this pull request as draft June 17, 2026 15:29
@seidewitz seidewitz force-pushed the master branch 2 times, most recently from 00acc2f to 2a8e96c Compare July 2, 2026 08:31
@AxelRICHARD

Copy link
Copy Markdown
Contributor Author

Hello @seidewitz do you need something else for this pull request? If no, can I set it as "Ready for review"?

@AxelRICHARD AxelRICHARD marked this pull request as ready for review July 8, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants