Skip to content

LDEV-6309: failing spec for self-referential struct inspection#7

Merged
zspitzer merged 2 commits into
mainfrom
ldev-6309-circular-struct-soe
May 9, 2026
Merged

LDEV-6309: failing spec for self-referential struct inspection#7
zspitzer merged 2 commits into
mainfrom
ldev-6309-circular-struct-soe

Conversation

@zspitzer
Copy link
Copy Markdown
Member

@zspitzer zspitzer commented May 9, 2026

Summary

  • Failing TestBox spec reproducing LDEV-6309
  • StackOverflowError when expanding the variables scope on a struct that references itself

Test only — no fix yet. Pushing this first to watch CI go red, then a follow-up commit will apply the fix in ValTracker.java.

Reported on dev.lucee.org: https://dev.lucee.org/t/lucee-debugger-extension-in-vscode/17236/5

Repro

s = {};
s.self = s;
// breakpoint here, expand `variables` in VS Code -> StackOverflowError

Stack trace cycles between StructImpl.hashCode() and ConcurrentHashMapNullSupportJDK.hashCode().

Root cause (for the follow-up fix)

ValTracker.wrapperByObj is a WeakHashMap — keys compared by equals()/hashCode() rather than identity. Every idempotentRegisterObject(obj) calls hashCode() on the value. Self-referential struct → infinite recursion.

Fix in follow-up: swap to org.lucee.extension.debugger.util.ConcurrentWeakKeyMap (already in the project, identity-keyed via System.identityHashCode).

Test plan

  • CI fails on the new it() block in VariablesTest.cfc with StackOverflowError
  • Existing variables tests still pass (new artifact is isolated)
  • Follow-up fix commit turns CI green

@zspitzer zspitzer merged commit 1db6318 into main May 9, 2026
15 checks passed
@zspitzer zspitzer deleted the ldev-6309-circular-struct-soe branch May 9, 2026 16:19
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