Skip to content

fix(#371): stop using XCAFApp_Application::GetApplication() singleton — v1.15.17 - #373

Merged
gsdali merged 1 commit into
mainfrom
fix/371-getapplication-singleton
Jul 24, 2026
Merged

fix(#371): stop using XCAFApp_Application::GetApplication() singleton — v1.15.17#373
gsdali merged 1 commit into
mainfrom
fix/371-getapplication-singleton

Conversation

@gsdali

@gsdali gsdali commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Per upstream maintainer feedback on OCCT#1396
(our #353 repro issue): XCAFApp_Application::GetApplication() "exists solely for compatibility
reasons"; OCCT's own guidance since 7.1 is a private TDocStd_Application per caller, not a
shared singleton. Our #341/#344/#349/#353 race cluster traced back to every document sharing one
process-wide singleton.

Bridge-only change — no OCCT kernel patch, OCCT.xcframework unchanged. OCCTBridge.xcframework
(the opt-in prebuilt bridge from #339) rebuilt since Sources/OCCTBridge/src/*.mm changed;
Package.swift's URL/checksum bumped to v1.15.17.

Test plan

  • Ground-truth C++ test: bare TDocStd_Application vs XCAFApp_Application::GetApplication() — equivalent
  • Full swift test (4428 tests / 1285 suites) — clean, re-run twice
  • Scripts/tsan-stress.sh swift (bridge-level TSan, 445 tests) — clean
  • Scripts/tsan-stress.sh run (kernel-level gate, 9 scenarios incl. new 371-getapplication-singleton-elimination) — clean
  • Prebuilt-bridge path (OCCTSWIFT_BRIDGE_PREBUILT=1) — build + OCCTXCAFTests clean
  • New upstream OCCT issue filed for the two newly-found races (OCCT#1398)
  • New OCCTSwift issue (Stop using XCAFApp_Application::GetApplication() singleton — per-instance TDocStd_Application instead #371) filed and closed by this PR

🤖 Generated with Claude Code

… (v1.15.17)

Per upstream maintainer feedback on OCCT#1396 (our #353 repro): the singleton
"exists solely for compatibility reasons"; OCCT's own guidance since 7.1 is a
private TDocStd_Application per caller. Every OCCTDocument now builds its own
private app instance instead of sharing the process-wide singleton, closing
our own exposure to the #341/#344/#349/#353 shared-state race family.

A dedicated confirmation harness (private app per thread, zero shared state,
zero serialization) found this wasn't a clean win: it surfaced two previously
uncaught OCCT races (Resource_Manager::Debug, Storage_Schema::ICurrentData())
that only became reachable once application-instance construction genuinely
runs concurrently -- filed upstream as OCCT#1398. ocafStoreMutex() coverage
was expanded (not removed) to close the gap; the #344/#349/#353 upstream PRs
stay open, since they fix real bugs in a pattern OCCT's own header still
documents as the only valid way to get an XCAFApp_Application.

Full swift test (4428 tests) clean. TSan gate (bridge-level + 9 kernel-level
scenarios, including the new 371 harness) clean.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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