Commit 733b8e1
KTOR-9373 Make ConcurrentMap iteration safe on Native (#5407)
* KTOR-9373 Add test for CIOEngine.close() with active endpoints
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* KTOR-9373 Make ConcurrentMap iteration safe on Native
Return snapshot copies from entries/keys/values to match JVM's
ConcurrentHashMap weakly-consistent iteration semantics. Also
synchronize size and isEmpty() which were reading without the lock.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Clean up CIOEngine close test: remove issue prefix and comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Address review feedback (iteration 1)
- Fix ConcurrentModificationException in ConcurrentMap.entries on Native:
use LinkedHashMap(delegate).entries to create entries that don't hold
references to the original backing map's EntryRef objects
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 1f83f21 commit 733b8e1
2 files changed
Lines changed: 19 additions & 5 deletions
File tree
- ktor-client/ktor-client-cio/common/test
- ktor-utils/posix/src/io/ktor/util/collections
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
174 | 188 | | |
175 | 189 | | |
176 | 190 | | |
| |||
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
0 commit comments