MagicStack / MagicStack/asyncpg

Segfault with NULL value in cell

オープン
#764 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
8.1k
フォーク
468
PR マージ指標
30日以内にマージされた PR はありません

説明

  • asyncpg version: 0.23.0
  • PostgreSQL version: 13
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    : No
  • Python version: 3.8
  • Platform: Ubuntu Xenial
  • Did you install asyncpg with pip?: Yes
  • Can the issue be reproduced under both asyncio and
    uvloop?
    : Yes

My table looks like this, and is using the citext extension

CREATE TABLE public.items
(
    item_id     bigint                       NOT NULL,
    tags        citext[] default '{}' not null
);

I have a simple query

query = """SELECT tags FROM items WHERE item_id = 304028"""

async with pool.acquire() as c:
    result = await c.fetchval(query)
    print(result)
    val = result[2]

This gives the following output
['debuff', 'buff', <NULL>]
And upon trying to access the second item of the list results a segmentation fault occurs.

Inspecting the database with PyCharm's database tab shows this cell as having the value {debuff,buff,""}

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

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

ソースファイルやテストは指定されていません。まず、報告された asyncpg 0.23.0 のクエリを提供された PostgreSQL スキーマに対して再現し、NULL 要素を含む citext[] の結果がどのようにデコードされるかを調査してください。同じアクセスで segfault が発生しなくなり、NULL 値が安全に処理されれば完了です。

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

評価

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

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

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