Thin mode: setting `Connection.call_timeout` after DPY-4011 crashes the interpreter (SIGSEGV / 0xC0000005)
还没有人认领这个 Issue。
评估
调研方向
Start with the call_timeout setter in oracledb/connection.py (around line 578 in 26.0.0, line 197 in 4.0.2) and the thin implementation it calls, since the traces stop there. Reproduce with the script in the issue, which needs a second account with ALTER SYSTEM to kill the session. Done when assigning call_timeout on a connection that is_healthy() reports as False raises DPY-1001 or is a no-op, with no segfault, and the behaviour matches ping() and rollback().
由索引模型根据 Issue 内容生成。
描述
1. What versions are you using?
- python-oracledb 26.0.0 and 4.0.2, thin mode (both crash)
- Python 3.11.16 (main, Aug 14 2026) [Clang 22.1.3]
- Linux-7.0.0-38-generic-x86_64-with-glibc2.43
- Also seen on Windows (access violation
0xC0000005), python-oracledb 26.0.0 and 4.0.2 - Oracle Database 19c Enterprise Edition 19.9, non-CDB
2. Is it an error or a hang or a crash?
A crash. The process dies with SIGSEGV (exit status 139) on Linux, or 0xC0000005 on Windows. No Python exception is raised.
3. What error(s) or behavior are you seeing?
The session is killed on the server. The next call raises DPY-4011 as expected, and is_healthy() returns False. Reading call_timeout still works. Assigning call_timeout (any value, including 0) then crashes the interpreter:
execute: DPY-4011: the database or network closed the connection
is_healthy: False
call_timeout: 0
Fatal Python error: Segmentation fault
Current thread 0x00007748c983b740 (most recent call first):
File ".../site-packages/oracledb/connection.py", line 578 in call_timeout
File "repro.py", line 27 in <module>
Extension modules: oracledb.arrow_impl, oracledb.base_impl, oracledb.thick_impl, _cffi_backend, oracledb.thin_impl (total: 5)
On 4.0.2 the trace is the same, at connection.py, line 197, in call_timeout.
It is deterministic: 13 of 13 runs crashed for each case, on both versions. That holds whether the session is killed while idle or during a call (begin dbms_session.sleep(10); end; with call_timeout = 30000), and for setter values 0 and 5000.
These do not crash:
- the setter on a live connection;
- the setter on a session killed on the server whose loss the driver has not yet seen (
is_healthy()stillTrue), where the next execute raises DPY-4011 normally; - on the dropped connection: reading
call_timeout,is_healthy(),cursor().close()andclose().ping()androllback()raiseDPY-1001: not connected to database.
Expected: an exception such as DPY-1001: not connected to database, as ping() and rollback() raise, or a no-op. Not a segfault.
4. Does your application call init_oracle_client()?
No. Thin mode.
5. Include a runnable Python script that shows the problem.
You need a second connection with ALTER SYSTEM privilege to kill the first session. Run it with python -u -X faulthandler repro.py.
import os
import time
import oracledb
user = oracledb.connect(
user=os.environ["APP_USER"], password=os.environ["APP_PASSWORD"], dsn=os.environ["DSN"]
)
admin = oracledb.connect(
user=os.environ["ADMIN_USER"], password=os.environ["ADMIN_PASSWORD"], dsn=os.environ["DSN"]
)
(sid,) = user.cursor().execute("select sys_context('userenv', 'sid') from dual").fetchone()
(serial,) = admin.cursor().execute(
"select serial# from v$session where sid = :1", [int(sid)]
).fetchone()
admin.cursor().execute(f"alter system kill session '{sid},{serial}' immediate")
time.sleep(0.5)
try:
user.cursor().execute("select 1 from dual")
except oracledb.Error as e:
print("execute:", e) # DPY-4011: the database or network closed the connection
print("is_healthy:", user.is_healthy()) # False
print("call_timeout:", user.call_timeout) # reading is fine
user.call_timeout = 5000 # Segmentation fault
print("not reached")
Workaround: check is_healthy() before assigning call_timeout. It turns False at the same DPY-4011 that makes the setter fatal.
- 主要语言
- Python
- 星标
- 455
- 派生
- 119
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
oracle/python-oracledb 的其他 Issue
-
Client Library or Database
难度 4/5 3-5 天 新手友好度 25/100
oracle/python-oracledb#620 · 3 条评论 ·
-
asyncio: DPY-4011 on connect_async() when the listener closes the original socket after a redirect可能已有人在做 @AlexGracas 于 9 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 35/100
oracle/python-oracledb#616 ·
-
bug
难度 4/5 3-5 天 新手友好度 48/100
oracle/python-oracledb#615 ·
-
Fetch character columns as raw bytes in the database character set into data frames (Thick mode)未关闭enhancement
难度 5/5 一周以上 新手友好度 35/100
oracle/python-oracledb#614 · 1 条评论 ·
-
Client Library or Database
难度 4/5 3-5 天 新手友好度 35/100
oracle/python-oracledb#613 · 3 条评论 ·
查看 oracle/python-oracledb 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
common-workflow-language/cwl-utils#477 ·
维护者通常 1 天内回复
-
Add dependabot未关闭feat
难度 2/5 1 小时以内 新手友好度 72/100
open-nudge/opentemplate#204 ·
维护者通常 1 天内回复
-
github-stale-ci-pr-closer: KV state is double-wrapped, never persists, and hits the depth-32 limit可能已有人在做 @VascoSch92 今天认领。 未关闭priority:medium ready-for-dev
难度 2/5 1-3 小时 新手友好度 72/100
OpenHands/extensions#781 ·
维护者通常 1 天内回复
-
bug good first issue
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
curriculum documentation quality
难度 2/5 1-3 小时 新手友好度 78/100
githubnext/gh-aw-workshop#4638 ·
维护者通常 1 天内回复