Calling `retain` on a closed ArrowBuf revives it, into an undefined state
- 主要言語
- Java
- スター
- 94
- フォーク
- 152
- 平均マージ
- 3日 16時間
- マージ済み PR(30日)
- 11
説明
### Describe the bug, including details regarding any error messages, version, and platform.
```kotlin
@Test
fun testArrowBufRetainBug() {
RootAllocator().use { al ->
val buf = al.buffer(10)
buf.close()
// correctly throws
assertThrows { buf.referenceManager.retain() }
assertEquals(0, buf.refCnt()) // nope, it's 1
// doesn't throw, ref-count is 1 - so the caller assumes they've successfully taken a reference
// but the underlying memory has already been reclaimed and re-used
assertThrows { buf.referenceManager.retain() }
}
}
```
Caused by the `getAndAdd` in `BufferLedger.retain(int)` - this is what leaves the ref-count positive, so on the next call, this doesn't fail.
Some kind of compareAndSet instead, perhaps?
Cheers,
James
コントリビューションガイド
調査の方向性
Start at BufferLedger.retain(int), where the issue identifies getAndAdd as the source of the incorrect positive reference count. Run the provided testArrowBufRetainBug reproduction and verify that closing the buffer leaves refCnt() at 0 and that subsequent retain() calls still throw IllegalArgumentException.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- backend
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 52/100