Summary
EqualityChain (built for every variable of degree>1, variables/random.jl) shares two BitVectors (cacheleft/cacheright) and per-node mutable Message caches among all outbound mappings. materialize! (src/nodes/equality.jl:130-152) and ChainInvalidationCallback (equality.jl:169-182) read/write those structures with no lock. Under the documented ScheduleOnStreamPostprocessor(AsyncScheduler()) (postprocessors/scheduled.jl), concurrent outbound computations for different indices can tear/overwrite the cache and produce outbound messages from stale or partially-written prefix products — a silent-wrong-message hazard.
Impact / scope
- Default single-threaded scheduler is safe; this is latent.
- Opt-in async scheduling + high-degree variables ⇒ potential lost updates → silent wrong messages.
Suggested fix
Hold a per-chain ReentrantLock across materialize! and the invalidation callback (or use atomic cache bits and re-validate iscached before trusting a read). This is a design/trade-off change, so a PR description (not a committed branch) is drafted in prs/pr-17-equalitychain-lock.md for maintainer discussion.
Summary
EqualityChain(built for every variable of degree>1,variables/random.jl) shares twoBitVectors (cacheleft/cacheright) and per-node mutableMessagecaches among all outbound mappings.materialize!(src/nodes/equality.jl:130-152) andChainInvalidationCallback(equality.jl:169-182) read/write those structures with no lock. Under the documentedScheduleOnStreamPostprocessor(AsyncScheduler())(postprocessors/scheduled.jl), concurrent outbound computations for different indices can tear/overwrite the cache and produce outbound messages from stale or partially-written prefix products — a silent-wrong-message hazard.Impact / scope
Suggested fix
Hold a per-chain
ReentrantLockacrossmaterialize!and the invalidation callback (or use atomic cache bits and re-validateiscachedbefore trusting a read). This is a design/trade-off change, so a PR description (not a committed branch) is drafted inprs/pr-17-equalitychain-lock.mdfor maintainer discussion.