Skip to content

[DO NOT MERGE] Diagnose the macOS CI stall on next - #128

Closed
Mx-Iris wants to merge 31 commits into
mainfrom
diagnostics/ci-hang-watchdog
Closed

Mx-Iris wants to merge 31 commits into
mainfrom
diagnostics/ci-hang-watchdog

Conversation

@Mx-Iris

@Mx-Iris Mx-Iris commented Sep 29, 2026

Copy link
Copy Markdown
Member

Diagnostics only; this PR will be closed without merging.

The macOS jobs for #127 (Release 0.21.0) stalled seconds into the test phase, in both the debug and the release job, and sat there for about 70 minutes until the run was cancelled. The same --filter completes locally on a 10-core Mac in under 5 minutes, and the console output reaches the log in buffered chunks, so the log never showed which tests were running.

The branch is next at 8de6062 with only .github/workflows/macOS.yml changed:

  • the tests are built in a separate step, then run with a Swift Testing event stream;
  • if the test phase is still running after 12 minutes, the job dumps the tests that started but never ended, the memory and swap state, and a sample of every thread in the test process, and uploads them as an artifact;
  • the job times out at 60 minutes;
  • the SwiftPM build cache is restored but not saved, so this PR does not push main's caches out of the quota.

Swift 6.4 refuses to emit a module interface without an explicit
language mode (Swift 6.3 only warned), so every case in
ProjectedOpaqueMemberWitnessTests failed on Xcode 27 before the fixture
was read. Pass -swift-version 5, the mode swiftc used when none was
given, to both compiles.

That exposed a second difference: Swift 6.4 writes a module-qualified
name in the interface with a module selector
(ProbeProjectionClient::Client, SE-0491) where Swift 6.3 wrote a dot.
The case comparing the printed typealias with the compiler's spelling
pins the opaque attribute form and the parentheses, not the separator,
so it normalizes the selector before comparing. All four cases pass on
Xcode 27, and the fixture compiles without diagnostics on Xcode 26.6.

FixtureTestingAndContinuousIntegration.md records both traps.
MachOKitExtensions 0.1.2 decides whether an in-process image is in the
dyld shared cache from its MH_DYLIB_IN_CACHE header flag rather than
from being loaded at or above sharedRegionStart. An image outside the
cache that was loaded past the shared region was taken for a cache
image: the member, sub_ and IMP addresses shown for it came out
meaningless, and in full test runs the ProtocolRecordTests fixture
picker read a wrong location (review adjudication A51).

MachOImageCacheMembershipTests maps a copy of the test bundle's header
and load commands past the shared region. Against 0.1.1 both relocation
cases fail; against 0.1.2 all three cases pass. The suite joins the CI
filter, and AGENTS.md lists it among the tests pinning
MachOKitExtensions behavior.

A51 is marked fixed and its impact corrected: the SIGBUS came from test
support code, and in the library a misclassified image only gets wrong
displayed addresses. A50 stays deferred past 0.1.2. Evolution log
section 61 records the batch.
# Conflicts:
#	Documentations/Internal/ProjectEvolutionLog.md
A Swift class whose source wrote `@objc(NSColorModel)` is known to the
Objective-C runtime by that name instead of its `_TtC…` mangling. The binary
keeps the fact in two places only: `HasCustomObjCName` in the class
metadata's flag word and the name in the class object's `class_ro_t`.

`SwiftInspection.SwiftClassObjectIndex` joins them to the class's nominal
type descriptor through the metadata itself. A class object in
`__objc_classlist` is the Swift metadata, so the flag word and the
descriptor pointer are read off it (the pointer through its own field, so a
file's rebase is resolved first); a class with a resilient superclass,
which is not in the class list, is read from its
`ResilientClassMetadataPattern`. Interface, diff/evolution headers and dump
print `@objc(Name)`, or `@_objcRuntimeName(Name)` on the native Swift object
model, where `@objc` is not legal.

The same missing join kept two consumers away from every renamed class,
since both found a Swift class's class object by demangling its runtime
name: the ObjC member recovery (a renamed class lost every `@objc` and
`override`, and a stripped one had its ObjC members recovered as `final`)
and the static layout engine's own-`instanceStart` slide. The member lookup
now merges in the renamed classes by qualified name, keeping two same-named
private classes ambiguous whichever of them was renamed; the layout engine
asks by descriptor when its table misses.

The SymbolTestsCore snapshots change accordingly: the two `@objc(…)` fixture
classes gain the attribute line and `override init()`, and their dump gains
the ancestor chain and member comments.
`RenamedObjCClassFixture` compiles three images: a library-evolution Swift
kit (a resilient superclass), an Objective-C base whose ivars only its
implementation declares (so the runtime slides a subclass's fields past its
real size), and the client, full and `strip -x`. The client carries one
class per shape that can be renamed — to another name, to its own name,
nested, on the native object model, over the resilient superclass, an
`@objc` actor — beside the control that is not renamed, and two same-named
private classes of which one is renamed.

The suites cover the index through both readers, the interface and the
diff header, the dump, the member recovery (joined with and without the
thunk symbols), the layout engine's slide checked against the realized
ivars, the eviction, and AppKit's `NSScrollPocket` on the running system.
Each failed on the unfixed `next`, the control excepted.
The proposal (a lightweight draft, accepted by the user and implemented on
this branch), the implementation note `CustomObjCClassNames.md`, the member
recovery and layout engine notes, the glossary entry for a renamed class,
the evolution log section, the roadmap's revived P2-14, the module list in
AGENTS.md, the README feature list, and a note in the agent plugin's skill
on reading `@objc(Name)` and `@_objcRuntimeName(Name)` in the output.
…ion-registry

Per-image cache overhaul for SharedCache: replace subclassing with a
composed get-or-build primitive, key entries on a UUID-hashed
SharedCacheKey instead of a boxed AnyHashable, move per-image eviction
into a registry with eviction groups, drop the per-instance memory
pressure monitors in favour of an explicit host API, and trap on
same-thread re-entrant builds. Names stay as they are for now.
…nging

A build closure that resolved the entry it was itself building found its
own in-flight promise and waited for a fulfilment that only its own
return could produce. Before the promise rewrite this trapped on the
non-reentrant cache lock; since then it hung silently. The promise now
records its builder thread and resolve() traps with the key when the
waiter is that thread. Pinned by an exit test.

The two Swift Concurrency parallelism tests asserted overlap by wall
clock and failed under a loaded full-suite run; they now prove overlap
by a timed rendezvous between two builds, the same shape the GCD test
already used.
…oxed AnyHashable

Every storage(in:) lookup boxed the reader's MachOTargetIdentifier into
an AnyHashable — a heap allocation, since the uuidFile payload does not
fit the existential's inline buffer — and hashed the whole install path,
on lookups made once per symbol and once per mangled name. SharedCacheKey
hashes a uuidFile identifier on its UUID alone and an image identifier on
its base address alone; the path still decides equality. The three
hand-written per-image stores and the eviction registry key on it too.
SharedCache is final. The build closure is supplied at the call site,
where the reader's concrete type is known, so the six indexes that
re-derived it inside buildStorage(for:) with an as? MachOFile / as?
MachOImage split now re-type the reader once through a shared helper
(objcImplementationClassReader / swiftSectionReader) and pass it to
their generic build. A missing build is a compile error rather than a
cache that silently rebuilds on every lookup.

The eleven former subclasses keep their shared instance and their query
API; each holds a private SharedCache and forwards storage(in:),
contains(in:) and remove(for:) to it. SymbolIndexStore keeps an
uncached buildStorage(for:) for the baseline measurements. The two
process-scoped memos (InternedNodeReferenceCache, SymbolicDemanglerCache)
become plain static lets instead of type-keyed cache entries.

PropertyWrapperTypeCatalogStore and ObjCAncestorResolverStore are now
thin wrappers over SharedCache: their default builds ran under their own
lock and blocked every image's lookups behind one file's dependency
resolution; they run outside the lock now, and register(_:for:) is a
SharedCache operation.
…ry; drop the memory-pressure monitors

Every SharedCache names its SharedCacheEvictionGroup at creation and
registers with the process-wide registry. The declaration indexer's
claims — sampled inside the registry's lock, first registration only —
now cover every group, and its deinit is one deregistration; the last
live owner's eviction expands the claimed groups by their dependents
(symbolStore takes the symbolic-mangling index, the @implementation
class index and the ObjC hierarchy state; internedNames takes the
demangle memo), which the indexer's deinit and three removeCache
helpers used to spell out separately. Five renderer- and thunk-side
caches that had no per-image eviction at all gain one.

The per-instance MemoryPressureMonitor is gone: it cleared entries
behind the ownership rules, and to no effect, since live NodeReferences
pinned the storage anyway. A host that wants to shed state under
pressure calls SharedCacheRegistry.shared.evictImagesWithoutLiveOwners().

CI runs the four cache suites.
The GCD rendezvous blocked eight libdispatch workers until every build
had entered its closure; under a saturated full-suite run the workers
were not granted within the 30 s timeout and the test read that as the
serialization failure it exists to catch. Two builds prove the overlap
and cannot starve themselves, the same reasoning the Swift Concurrency
variants already follow.
Adds the MachOCaches module reference, corrects AGENTS.md (the module
was described as dyld shared cache support) and gives it a block on
adding or evicting a per-image cache, registers eviction group / claim /
live owner in the glossary, fixes three statements that still described
memory-pressure eviction, appends the evolution log section, and records
the implementation deviations and verification in the proposal.
…lared by the modules that own caches

The closed enum made the bottom module name every cache above it, so
adding a cache anywhere meant editing MachOCaches. The group is now a
name-only struct; MachOCaches declares none. Each module declares its
own groups in a SharedCacheEvictionGroup+<Module>.swift extension, and
a cache whose entries point into another group's storage says follows:
at creation — the registry builds the reverse table from those
declarations and expands it transitively where the dependents table
used to be spelled out by hand. Claims and the host's sweep range over
the registered groups.

The registry tests declare groups of their own and cover the
transitive case; MachOSymbols is imported directly where its
package-level groups are named, since a package declaration is not
visible through MachOFoundation's re-export.
Each build blocks until it meets the other, so each needs a thread for
the whole wait. On the global dispatch queue a saturated full-suite run
did not grant even two workers within the 30 s timeout, which read as
the serialization failure the test exists to catch. A Thread exists the
moment it is started, whatever the pool is doing.
… result

The check searched the whole symbol tree for the first returnType node, and a
closure parameter's return type comes before the initializer's own in that
walk. It went wrong both ways: AppKit's non-failable
NSCollectionViewDiffableDataSource.init(collectionView:itemProvider:), whose
item provider returns NSCollectionViewItem?, printed as init?, and SwiftUI's
failable CoreDisplayLink.init?(displayID:handler:), whose handler returns (),
printed as init.

It now reads the direct returnType child of the initializer's function type,
past a dependentGenericType wrapper. An initializer declared on Optional itself
(Optional.init(_:), SwiftUI's extension Optional { init(if:then:) }) returns
Wrapped? because that is its Self; only Wrapped?? is failable.
…tors

A library-evolution image keeps a public class method's implementation symbol
local and exports only its dispatch thunk (Tj) and method descriptor (Tq).
Once the local symbols are stripped - AppKit in the OS dyld shared cache - the
interface, which built every member from implementation symbols, dropped all
of those members: NSTableViewDiffableDataSource and
NSCollectionViewDiffableDataSource came out as init and deinit alone, and 53
members were missing across AppKit.

- classDispatchLookups builds a stand-in member symbol for every own vtable
  slot its Tq names: the implementation's mangled name (the Tq name without its
  suffix) at the implementation offset, one hop further for an async method
  (its slot holds the async function pointer). Tombstone slots and modify /
  read coroutines get none.
- indexMembers adds each stand-in whose member no real symbol declares; a real
  symbol always wins.
- The byCategory printer puts a class's vtable members first, in slot order -
  the source's declaration order for its own slots, the way the dump walks
  them - then groups the members that own no slot. A slot nothing names is
  skipped.
- ABI snapshot formatVersion 5 -> 6: an older baseline of a stripped image
  would report every recovered member as added.

The SymbolTestsCore interface snapshot only reorders; stripped of blank lines
and indentation its line set is unchanged. DescriptorOnlyVTableMemberTests
compiles a library-evolution fixture and checks that its strip -x copy prints
exactly like the full build, file and in-process.

Evolution proposal: interface-descriptor-only-vtable-members.
…d cache

The archived macOS cache directory was renamed back from 26.6 to 26.6.2, and a
constant that no longer matches silently drops that leg from the run.
…scriptor-only-vtable-members)

The lightweight proposal, the implementation note (why the stand-in symbol
carries the implementation's name and offset, which slots are left alone,
the ObjC and synthesized-member gaps, the A/B verification), the glossary
term, the module references, the evolution ledger, the rendering-verification
pitfalls (the 26.6.2 directory, Versions/C frameworks), the README flag note,
and the agent skill's notes on member order, stripped images and snapshot
format 6.
swift-capstone 6.0.1 maps the old ARM64 trait onto CAPSTONE_HAS_AARCH64
again. Under 6.0.0 a consumer still spelling the pre-v6 trait name got
no AArch64 backend, so the thunk reader had nothing to decode with.
The symbolic-mangling cross-check found two AppKit local types whose
descriptor-built names drop the enclosing function. The fix is deferred,
so the symptom, suspected cause, fix direction and acceptance criteria
go into a roadmap entry, linked from evolution 0050 and the
implementation note.
The previous docs commit re-added the SymbolIndexStore acceptance row at
its chronological position without removing the original, left a
trailing blank line, and the new roadmap entry linked the proposal by
its pre-numbering draft filename, which no longer exists.
…' into next

# Conflicts:
#	Documentations/Evolutions/README.md
#	Documentations/Internal/ProjectEvolutionLog.md
#	Documentations/README.md
Three proposals had landed on next without a number, all still marked
In Progress although their code had merged. Numbered in landing order
against the shared branches' maximum (0051):
- 0052 objc-custom-class-name (28c0e6c..b521c33, directly on next)
- 0053 shared-cache-composition-and-eviction-registry (ac9da4c)
- 0054 interface-descriptor-only-vtable-members (1437925)

Each moves to Implemented with a decision-log entry; every same-repo
link, the two indexes, the glossary and the prose mentions follow the
renames (code comments keep citing the slug, as the proposal rules ask).
The evolution log's three dated sections become 63-65, and they and
section 61 name 0.21.0 as their release.
draft-static-layout-through-accessor-thunks has not started and stays
a draft.
Bumps BundledVersion and both agent plugin manifests to 0.21.0, adds
Changelogs/0.21.0.md, points the README's package snippet at 0.21.0,
and dates the skill's snapshot format-6 note to this release.

The evolution log gains section 66 for the release batch: no separate
release review (the three features each ran the full suite and the
rendering A/B when they landed), and the verification of this branch
with remote dependencies only: full suite 2141 tests / 404 suites, raw
exit code 0, one recorded known issue; release builds on Xcode 26.6
(x86_64, arm64) and Xcode 27 (arm64) with 0 warnings; Homebrew's
struct-only dylib test 0 failures in 30 runs; plugin validation passes.
Not for merging. The macOS jobs for the 0.21.0 release PR stalled
within seconds of the test phase starting and sat until cancelled; the
console output reaches the log in buffered chunks, so it never showed
which tests were running.

This run builds the tests separately, runs them with a Swift Testing
event stream, and after 12 minutes dumps the tests that started but
never ended, the memory state and every thread's stack of the test
process. The job times out at 60 minutes, and the SwiftPM build cache
is restored but not saved.
Copilot AI balanced review requested due to automatic review settings September 29, 2026 02:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Cache eviction can miss lazily registered groups and allow in-flight builds to repopulate evicted entries.

Review effort: Balanced
Findings: 2 Medium severity · 1 Low severity

Open (3)
What changed in this PR

Adds CI hang diagnostics on top of the 0.21.0 release branch, which also introduces renamed Objective-C class recovery, descriptor-only vtable members, and centralized per-image cache eviction.

Changes:

  • Separates test building/execution and adds a 12-minute watchdog with event, memory, and stack diagnostics.
  • Implements 0.21.0 interface, metadata, layout, and snapshot-format changes.
  • Refactors per-image caches and expands regression coverage and documentation.

Documentation is broadly synchronized, but the SPI migration guidance remains inconsistent with the new initializer visibility.

File Description
Tests/​SwiftPrintingTests/​InitializerFailabilityPrintingTests.swift Tests initializer failability.
Tests/​SwiftInterfaceTests/​ProjectedOpaqueMemberWitnessTests.swift Handles Swift 6.4 fixture output.
Tests/​SwiftInspectionTests/​SwiftClassObjectIndexTests.swift Tests renamed-class indexing.
Tests/​SwiftIndexingTests/​PerImageCacheEvictionTests.swift Expands eviction tests.
Tests/​SwiftDumpTests/​Snapshots/​.../​objCClassWrappersSnapshot.1.txt Updates dump snapshot.
Tests/​SwiftDumpTests/​CustomObjCClassNameDumpTests.swift Tests renamed-class dumps.
Tests/​MachOCachesTests/​SharedCacheRegistryTests.swift Tests cache ownership rules.
Tests/​MachOCachesTests/​SharedCacheKeyTests.swift Tests cache-key semantics.
Tests/​MachOCachesTests/​MachOImageCacheMembershipTests.swift Tests dyld-cache membership.
Sources/​Utilities/​MemoryPressureMonitor.swift Removes automatic pressure monitoring.
Sources/​SwiftThunkAnalysis/​Resolution/​SharedCacheEvictionGroup+SwiftThunkAnalysis.swift Defines thunk cache group.
Sources/​SwiftThunkAnalysis/​Resolution/​MetadataAccessorIndex.swift Registers accessor cache.
Sources/​SwiftThunkAnalysis/​Resolution/​DependencyImageResolver.swift Registers resolver cache.
Sources/​SwiftPrinting/​SwiftDeclarationPrinter.swift Prints attributes and vtable order.
Sources/​SwiftPrinting/​SwiftDeclarationPrintConfiguration.swift Documents ordering behavior.
Sources/​SwiftPrinting/​NodePrinter/​FunctionNodePrinter.swift Fixes initializer failability.
Sources/​SwiftLayout/​StaticTypeLayoutResolver.swift Handles renamed-class layout.
Sources/​SwiftInterface/​SwiftDeclarationPrinter+DiffRendering.swift Prints attribute arguments in diffs.
Sources/​SwiftInspection/​SymbolicManglingIndex.swift Converts cache to composition.
Sources/​SwiftInspection/​SymbolicDemangler.swift Refactors demangling caches.
Sources/​SwiftInspection/​SharedCacheEvictionGroup+SwiftInspection.swift Defines inspection cache groups.
Sources/​SwiftInspection/​ObjCImplementationClassIndex.swift Converts index cache to composition.
Sources/​SwiftInspection/​ObjCClassMethodIndex.swift Adds renamed-class fallback.
Sources/​SwiftInspection/​ObjCClassHierarchy.swift Integrates provider eviction.
Sources/​SwiftInspection/​ObjCAncestorResolver.swift Converts resolver store to shared cache.
Sources/​SwiftInspection/​Extensions/​MachORepresentableWithCache+ReaderKinds.swift Centralizes reader retyping.
Sources/​SwiftInspection/​Extensions/​Descriptor+MethodDescriptorSymbols.swift Exposes attributed descriptor members.
Sources/​SwiftInspection/​CustomObjCClassName.swift Models custom runtime names.
Sources/​SwiftInspection/​AnonymousContextPrivateDiscriminatorIndex.swift Converts cache to composition.
Sources/​SwiftInspection/​SwiftClassObjectIndex.swift Indexes renamed Swift classes.
Sources/​SwiftDump/​Dumper/​ClassDumper.swift Prints custom class attributes.
Sources/​SwiftDiffing/​ABISnapshotDocument.swift Bumps snapshot format to 6.
Sources/​SwiftDeclarationRendering/​SharedCacheEvictionGroup+SwiftDeclarationRendering.swift Defines rendering cache groups.
Sources/​SwiftDeclarationRendering/​PropertyWrapperTypeCatalog.swift Refactors catalog storage.
Sources/​SwiftDeclarationRendering/​MultiPayloadEnumDescriptorCache.swift Refactors descriptor cache.
Sources/​SwiftDeclarationRendering/​Extensions/​Keyword+Swift.swift Adds runtime-name keyword.
Sources/​SwiftDeclarationRendering/​Extensions/​CustomObjCClassName+Keyword.swift Maps custom-name attributes.
Sources/​SwiftDeclarationRendering/​DependentMemberProjection.swift Registers projection caches.
Sources/​SwiftDeclaration/​Components/​SwiftAttribute.swift Adds runtime-name attribute.
Sources/​SwiftDeclaration/​Components/​Members/​OrderedMember.swift Adds vtable ordering helper.
Sources/​SwiftDeclaration/​Components/​Definitions/​TypeDefinition+MemberIndexing.swift Supplements missing vtable members.
Sources/​SwiftDeclaration/​Components/​Definitions/​TypeDefinition+Indexing.swift Records custom class names.
Sources/​SwiftDeclaration/​Components/​Definitions/​TypeDefinition+ClassDispatch.swift Synthesizes descriptor-backed symbols.
Sources/​SwiftDeclaration/​Components/​Definitions/​TypeDefinition.swift Stores and renders class-name metadata.
Sources/​SwiftDeclaration/​Components/​Building/​ClassDispatchLookups.swift Categorizes supplemental members.
Sources/​SwiftAttributeInference/​TypeAttributeInferrer.swift Infers renamed-class attributes.
Sources/​swift-section/​Version.swift Bumps version to 0.21.0.
Sources/​MachOSymbols/​SymbolIndexStore.swift Converts symbol cache to composition.
Sources/​MachOSymbols/​SharedCacheEvictionGroup+MachOSymbols.swift Defines symbol cache groups.
Sources/​MachOSymbols/​InternedNodeReferenceCache.swift Refactors interned-node storage.
Sources/​MachOCaches/​SharedCache.swift Implements composed shared caching.
Sources/​MachOCaches/​SharedCacheRegistry.swift Coordinates cache ownership and eviction.
Sources/​MachOCaches/​SharedCacheKey.swift Adds optimized cache keys.
Sources/​MachOCaches/​SharedCacheEvictionGroup.swift Models eviction families.
Sources/​MachOCaches/​SharedCacheBuildPromise.swift Detects same-thread reentrancy.
Scripts/​run-rendering-ab-verification.py Updates archived cache path.
Roadmaps/​2026-09-26-release-0.20.0-review-findings.md Records resolved dependency issue.
Roadmaps/​2026-09-24-local-type-context-names.md Records deferred local-type issue.
Roadmaps/​2026-04-13-swiftinterface-dump-improvements.md Marks custom-name work implemented.
README.md Documents 0.21.0 behavior.
Package.swift Raises dependency floors.
Documentations/​Internal/​SystemFrameworkRenderingVerification.md Updates verification guidance.
Documentations/​Internal/​SymbolicManglingSymbols.md Links deferred work.
Documentations/​Internal/​StaticLayoutEngine.md Documents renamed-class layout.
Documentations/​Internal/​SharedNodeStoreMigration.md Updates eviction semantics.
Documentations/​Internal/​ReviewAdjudications.md Records cache-membership fix.
Documentations/​Internal/​ObjCMemberRecovery.md Documents renamed-class lookup.
Documentations/​Internal/​Modules/​SwiftInterface.md Documents rendering order.
Documentations/​Internal/​Modules/​SwiftDeclaration.md Documents descriptor-only members.
Documentations/​Internal/​Modules/​README.md Registers cache documentation.
Documentations/​Internal/​Modules/​MachOSymbols.md Updates store-lifetime guidance.
Documentations/​Internal/​FixtureTestingAndContinuousIntegration.md Documents Swift 6.4 fixtures.
Documentations/​Internal/​DeclarationModelMemoryFootprint.md Updates cache-lifetime notes.
Documentations/​Glossary.md Adds new cache and member terminology.
Documentations/​Evolutions/​README.md Registers proposals 0052–0054.
Documentations/​Evolutions/​0054-interface-descriptor-only-vtable-members.md Specifies vtable-member recovery.
Documentations/​Evolutions/​0050-symbolic-mangling-symbol-index.md Updates decision history.
Changelogs/​0.21.0.md Adds release notes.
AGENTS.md Updates architectural guidance.
AgentPlugins/​swift-section/​skills/​swift-section-cli/​SKILL.md Updates CLI agent guidance.
AgentPlugins/​swift-section/​.codex-plugin/​plugin.json Bumps Codex plugin version.
AgentPlugins/​swift-section/​.claude-plugin/​plugin.json Bumps Claude plugin version.
.github/​workflows/​macOS.yml Adds the CI hang watchdog.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +151 to 157
public func removeEntry(for key: SharedCacheKey) {
_storageByKey.withLockUnchecked { dict in
if case .completed = dict[key] {
dict.removeValue(forKey: key)
}
}
}
Comment on lines +70 to +76
public func register(_ cache: any SharedCacheEvicting, group: SharedCacheEvictionGroup, follows: Set<SharedCacheEvictionGroup> = []) {
lock.lock()
defer { lock.unlock() }
cachesByGroup[group, default: []].append(WeakCache(cache: cache))
for followed in follows {
followersByGroup[followed, default: []].insert(group)
}
Comment thread Changelogs/0.21.0.md
## Breaking

- **The library no longer empties its per-image caches under memory pressure.** A host that relied on that calls `SharedCacheRegistry.shared.evictImagesWithoutLiveOwners()` (`@_spi(Internals) import MachOCaches`) when it wants memory back; it evicts every image no live `SwiftDeclarationIndexer` still owns.
- `SharedCache` (SPI `Internals`) is `final` and built by composition: `final class Foo: SharedCache<Storage> { override func buildStorage(for:) … }` becomes `final class Foo { private let cache = SharedCache<Storage>(evictionGroup: …) }`, looked up with `cache.storage(in: machO) { build($0) }`. `init()`, `buildStorage(for:)`, `buildStorage()`, `storage()`, `contains()` and `remove()` are removed. `SymbolIndexStore` and `InternedNodeReferenceCache` are no longer its subclasses; their instance API is unchanged.
…ead pool

On the 3-core CI runner the cooperative pool is three threads wide, and
three tests each blocked one of them with an untimed wait on work that
needed a thread of its own: concurrentCallsForSameKeyShareOneBuild and
registeringOverAnInFlightBuildWinsAndTheBuilderStillAnswersItsWaiters
waited for global-queue blocks the runner never scheduled, and
reentrancyFromTask waited for a Task that needed a pool thread. With all
three threads parked, no other test in the process ran again; both CI
jobs of the 0.21.0 release PR sat for about 70 minutes until cancelled.
main had only two of the three, which always left a thread free.

The counterparts of the two dispatch tests now run on dedicated
Threads, which exist the moment they start whatever the pools are
doing, and reentrancyFromTask runs its blocking outer build on a Thread
of its own and hands the result back through a continuation.
reentrancyFromTask used to hang on a one-thread pool
(LIBDISPATCH_COOPERATIVE_POOL_STRICT=1); the SharedCache suites now pass
there.
Copilot AI review requested due to automatic review settings September 29, 2026 02:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Mx-Iris

Mx-Iris commented Sep 29, 2026

Copy link
Copy Markdown
Member Author

Diagnosis done: three SharedCache tests each blocked one of the runner's three cooperative threads with an untimed wait on work that needed a thread, freezing the whole test process. The fix landed on next in 389b4a5 (tests moved onto dedicated threads, plus a one-thread-pool CI step and a 45-minute job timeout). The watchdog workflow stays reachable here as commit e473b89.

@Mx-Iris Mx-Iris closed this Sep 29, 2026
@Mx-Iris
Mx-Iris deleted the diagnostics/ci-hang-watchdog branch September 29, 2026 03:29
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.

2 participants