Commit 457bb11
fix: Data race on failedPromises in DeterministicRunnerImpl (#1060)
failedPromises (HashSet) is written to via
registerFailedPromise/forgetFailedPromise without holding the lock,
while close() reads it under the lock on another thread. Concurrent
HashMap.put and HashMap.size is a data race.
Replace HashSet with ConcurrentHashMap.newKeySet() so add/remove/copy
are safe without requiring callers to hold the lock.
Signed-off-by: Hünkar Tunç <tunc+UBER@uber.com>
Co-authored-by: Hünkar Tunç <tunc+UBER@uber.com>1 parent 806febb commit 457bb11
1 file changed
Lines changed: 2 additions & 1 deletion
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
121 | 122 | | |
122 | 123 | | |
123 | 124 | | |
124 | | - | |
| 125 | + | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
| |||
0 commit comments