apache / apache/arrow

[Python] Multiple warnings and asserts triggered in debug CPython 3.11

オープン
#33,765 コメント 9 件 リアクション 0 件 担当者 0 名 GitHub で見る
Component: Python Type: bug
主要言語
C++
スター
17.1k
フォーク
4.3k
平均マージ
3日 23時間
マージ済み PR(30日)
101

説明

### Describe the bug, including details regarding any error messages, version, and platform.

CPython [can be built in debug mode](https://docs.python.org/3/using/configure.html#python-debug-build) to catch some maybe-fatal-maybe-not errors. We have such python3.11 configured with `--with-pydebug` and pyarrow 10.0.1 installed, here is an example of gc warning
```
>>> import pyarrow as pa
>>> table = pa.table({'a': [1]})
gc:0: ResourceWarning: Object of type pyarrow.lib.Int64Array is not untracked before destruction
```
similar code sometimes triggers assertion
```
gc:0: ResourceWarning: Object of type pyarrow.lib.UInt16Array is not untracked before destruction
Modules/gcmodule.c:442: update_refs: Assertion "gc_get_refs(gc) != 0" failed
Enable tracemalloc to get the memory block allocation traceback

object address : 0x7f804e8762e0
object refcount : 0
object type : 0x7f80fcc3f5e0
object type name: pyarrow.lib.UInt16Array
object repr :

Fatal Python error: _PyObject_AssertFailed: _PyObject_AssertFailed
Python runtime state: initialized
```
Another crash
```
>>> import pyarrow as pa
>>> pa.table({0: []})
python: Objects/typeobject.c:1068: type_call: Assertion `!_PyErr_Occurred(tstate)' failed.
Aborted (core dumped)
```

### Component(s)

Python

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

デバッグ用の CPython 3.11 ビルド、pyarrow 10.0.1、および issue の例を使って、警告とクラッシュを再現します。Modules/gcmodule.c と Objects/typeobject.c の報告されたパスを調査し、続いて関係する pyarrow オブジェクトを追跡します。完了の条件は、例から警告、アサーション、fatal error が出なくなることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp, python
領域
backend, data
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。