Committed by
GitHub
Fix ConcurrentModificationException in IncomingDataStreamManager (#642)
* Fix ConcurrentModificationException in IncomingDataStreamManager * changeset
正在显示
2 个修改的文件
包含
9 行增加
和
1 行删除
.changeset/brown-guests-fly.md
0 → 100644
| @@ -257,7 +257,10 @@ class IncomingDataStreamManagerImpl @Inject constructor() : IncomingDataStreamMa | @@ -257,7 +257,10 @@ class IncomingDataStreamManagerImpl @Inject constructor() : IncomingDataStreamMa | ||
| 257 | */ | 257 | */ |
| 258 | override fun clearOpenStreams() { | 258 | override fun clearOpenStreams() { |
| 259 | synchronized(openStreams) { | 259 | synchronized(openStreams) { |
| 260 | - for (descriptor in openStreams.values) { | 260 | + // Create a copy since closing the channel will also remove from openStreams, |
| 261 | + // causing a ConcurrentModificationException | ||
| 262 | + val descriptors = openStreams.values.toList() | ||
| 263 | + for (descriptor in descriptors) { | ||
| 261 | descriptor.channel.close(StreamException.TerminatedException()) | 264 | descriptor.channel.close(StreamException.TerminatedException()) |
| 262 | } | 265 | } |
| 263 | openStreams.clear() | 266 | openStreams.clear() |
-
请 注册 或 登录 后发表评论