Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Broken error reporting through Python ADBC

未关闭
#181 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
cpp, postgresql, python
领域
api, databases

调研方向

通过 Python ADBC DBAPI 路径复现该查询,从 cur.execute 和游标关闭路径开始。跟踪 Flight SQL Action::SelectPreparedStatement 错误以及随后对 ClosePreparedStatement 的处理。当除以零能被及时报告,且不再出现 traceback 中显示的会话被窃取和清理错误时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

The following query should report a division by zero:

import adbc_driver_flightsql.dbapi as flight_sql

with flight_sql.connect(uri="grpc://localhost:15432",
                        db_kwargs={"username": "avogelsgesang",
                                   "adbc.flight.sql.rpc.call_header.x-flight-sql-database": "avogelsgesang"
                                   }
                        ) as conn:
   with conn.cursor() as cur:
        cur.execute("SELECT 1/0;")

However, this does not work as expected. Instead cur.execute first hangs for a couple of minutes before then reporting

Traceback (most recent call last):
  File "/home/avogelsgesang/Documents/af-query.py", line 9, in <module>
    cur.execute("SELECT 1/0;")
  File "/home/avogelsgesang/.local/lib/python3.10/site-packages/adbc_driver_manager/dbapi.py", line 669, in execute
    handle, self._rowcount = self._stmt.execute_query()
  File "adbc_driver_manager/_lib.pyx", line 1106, in adbc_driver_manager._lib.AdbcStatement.execute_query
  File "adbc_driver_manager/_lib.pyx", line 227, in adbc_driver_manager._lib.check_error
adbc_driver_manager.ProgrammingError: INVALID_ARGUMENT: [FlightSQL] failed to run: Action::SelectPreparedStatement: division by zero (InvalidArgument; ExecuteQuery)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/avogelsgesang/Documents/af-query.py", line 8, in <module>
    with conn.cursor() as cur:
  File "/home/avogelsgesang/.local/lib/python3.10/site-packages/adbc_driver_manager/dbapi.py", line 225, in __exit__
    self.close()
  File "/home/avogelsgesang/.local/lib/python3.10/site-packages/adbc_driver_manager/dbapi.py", line 611, in close
    self._stmt.close()
  File "adbc_driver_manager/_lib.pyx", line 1078, in adbc_driver_manager._lib.AdbcStatement.close
  File "adbc_driver_manager/_lib.pyx", line 1084, in adbc_driver_manager._lib.AdbcStatement.close
  File "adbc_driver_manager/_lib.pyx", line 227, in adbc_driver_manager._lib.check_error
adbc_driver_manager.ProgrammingError: INVALID_ARGUMENT: [FlightSQL] stolen session: 1283150246607583965 (InvalidArgument; ClosePreparedStatement)
Exception ignored in: <function Cursor.__del__ at 0x7fa517960280>
Traceback (most recent call last):
  File "/home/avogelsgesang/.local/lib/python3.10/site-packages/adbc_driver_manager/dbapi.py", line 766, in __del__
  File "/home/avogelsgesang/.local/lib/python3.10/site-packages/adbc_driver_manager/dbapi.py", line 611, in close
  File "adbc_driver_manager/_lib.pyx", line 1077, in adbc_driver_manager._lib.AdbcStatement.close
  File "adbc_driver_manager/_lib.pyx", line 293, in adbc_driver_manager._lib._AdbcHandle._close_child
  File "adbc_driver_manager/_lib.pyx", line 295, in adbc_driver_manager._lib._AdbcHandle._close_child
RuntimeError: Underflow in closing this AdbcStatement
主要语言
C++
星标
116
派生
10
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/arrow-flight-sql-postgresql 的其他 Issue

查看 apache/arrow-flight-sql-postgresql 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。