/claim #9681
This fixes the Scala Native WeakConcurrentBag crash path reported in #9681 by replacing the Native newConcurrentSet implementation from ConcurrentHashMap.newKeySet to Collections.synchronizedSet(new HashSet(...)).
Why this target:
ConcurrentHashMap.treeifyBin during concurrent KeySetView.add from WeakConcurrentBag.addToLongTermStorage.WeakConcurrentBag relies on Platform.newConcurrentSet for long-term storage (graduates).HashSet avoids this unstable ConcurrentHashMap path while preserving thread safety semantics.core/native/src/main/scala/zio/internal/PlatformSpecific.scalaPromiseSpec - waiter stack safety (10K forks) hits WeakConcurrentBag -> ConcurrentHashMap.treeifyBin NPE on Scala Native.ConcurrentHashMap.newKeySet usage specifically on Native for both overloads of newConcurrentSet.Local execution note: I could not run the full Scala build in this environment because
sbtis not installed.
Liuyi Yu
@yuliuyi717-ux
ZIO
@ZIO