Skip to content

Prevent type model compiler stack overflow - #1821

Merged
kevinherron merged 1 commit into
integration/1.2from
codex/fix-type-model-recursion
Jul 22, 2026
Merged

Prevent type model compiler stack overflow#1821
kevinherron merged 1 commit into
integration/1.2from
codex/fix-type-model-recursion

Conversation

@kevinherron

Copy link
Copy Markdown
Contributor

Summary

  • replace recursive declaration traversal with an explicit depth-first stack
  • preserve deterministic child ordering, cycle tracking, override precedence, and post-order member-type expansion
  • ensure over-depth models produce DEPTH_LIMIT_EXCEEDED instead of exhausting the JVM stack

Root cause

Each declaration level added both walkChildren and processChild frames. On JVMs with less usable thread stack, the native stack could be exhausted before the configured 512-level guard ran. This made the failure platform- and workload-sensitive: the focused test could pass while the full reactor failed.

Validation

  • mise exec -- mvn -q spotless:apply
  • mise exec -- mvn -q -pl opc-ua-sdk/sdk-server -am test -Dtest=TypeModelCompilerTest
  • mise exec -- mvn -q clean compile
  • mise exec -- mvn -q verify

Walk declarations iteratively so the configured depth limit is enforced
before JVM stack exhaustion on platforms with smaller thread stacks.
@kevinherron
kevinherron marked this pull request as ready for review July 22, 2026 22:48
@kevinherron
kevinherron merged commit 186bcba into integration/1.2 Jul 22, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant