/claim #9681

Proposed changes

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:

  • The observed stacktrace fails in ConcurrentHashMap.treeifyBin during concurrent KeySetView.add from WeakConcurrentBag.addToLongTermStorage.
  • WeakConcurrentBag relies on Platform.newConcurrentSet for long-term storage (graduates).
  • On Native, using a synchronized HashSet avoids this unstable ConcurrentHashMap path while preserving thread safety semantics.

Files changed

  • core/native/src/main/scala/zio/internal/PlatformSpecific.scala

Proof

  • Existing failing scenario in issue: PromiseSpec - waiter stack safety (10K forks) hits WeakConcurrentBag -> ConcurrentHashMap.treeifyBin NPE on Scala Native.
  • This patch removes the 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 sbt is not installed.

Claim

Total prize pool $150
Total paid $0
Status Pending
Submitted February 27, 2026
Last updated February 27, 2026

Contributors

LI

Liuyi Yu

@yuliuyi717-ux

100%

Sponsors

ZI

ZIO

@ZIO

$150