Skip to content

Fixes #6775: Guard ExtensionLoader joins during concurrent initialization - #7140

Open
BobSong-dev wants to merge 4 commits into
apache:masterfrom
BobSong-dev:fix/6775-extension-loader-concurrent-init
Open

BobSong-dev wants to merge 4 commits into
apache:masterfrom
BobSong-dev:fix/6775-extension-loader-concurrent-init

Conversation

@BobSong-dev

@BobSong-dev BobSong-dev commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Fixes #6775

Background

ExtensionLoader#getJoins() treated cachedInstances.size() matching the number of extension classes as proof that every cached Holder was ready. However, getJoin() publishes a new Holder before populating its order and value. A concurrent getJoins() call could therefore sort or return an incompletely initialized holder, causing an NPE or a null element.

Changes

  • Track Holder initialization with a volatile flag published after order and value are set;
  • Use the cached fast path only when every cached Holder is fully initialized;
  • Add a concurrent regression test for getJoins() observing an incomplete Holder.

Verification

  • .\mvnw.cmd -pl shenyu-spi test -DskipITs: 20 tests passed, 0 failures, 0 errors, 0 skipped;
  • Checkstyle: 0 violations;
  • git diff --check: 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.

[BUG] ExtensionLoader.getJoins() fast-path returns null / throws NPE under concurrent init

1 participant