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

Async Thin: call_timeout returns DPY-4024 before RESET completes

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

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python

调研方向

Start by reading BaseAsyncProtocol._process_timeout_helper() and trace how _break_external() and _receive_packet(message) handle DATA and RESET marker packets. Compare that flow with the packet sequence described in the issue and inspect related async protocol tests for timeout recovery. Done means a timed out call completes BREAK/RESET recovery before raising DPY-4024, and a subsequent statement does not fail with DPY-4011.

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

描述

bug
  1. What versions are you using?
  • Oracle Database Free 23.5.0.24.7 (local testing); Observed in production against Oracle Database 19c.
  • python-oracledb 4.0.2 and 26.0.1, Thin mode. The same timeout-helper code is present on main (c92c8420).
  • Python 3.13, asyncio, on macOS arm64 and Linux arm64.
  • Production also uses uvloop and SQLAlchemy 2.0 (oracle+oracledb_async), but the reproduction below uses native python-oracledb only.
  • Oracle Client: not applicable (Thin mode).
  1. Is it an error or a hang or a crash?

An error after a timeout, followed by a delayed failure when reusing a connection that still reports healthy.

  1. What error(s) or behavior you are seeing?

With call_timeout = 500, a statement that completes between approximately 500 and 1000 ms can raise DPY-4024 while connection.is_healthy() returns True. The next statement on that connection waits approximately 1 second and fails with:

DPY-4011: the database or network closed the connection
socket timed out while recovering from previous socket timeout

Representative output from the original reproduction on 26.0.1, Linux arm64:

  sleep=0.6: call 1 DPY-4024, is_healthy=True
    call 2 DPY-4011 after 1.01s
  sleep=0.7: call 1 DPY-4024, is_healthy=True
    call 2 DPY-4011 after 1.01s
  sleep=0.8: call 1 DPY-4024, is_healthy=True
    call 2 DPY-4011 after 1.00s

This is timing-dependent: some runs recover successfully or return ORA-01013 on the next call. The same behavior was reproduced on 4.0.2.

Source inspection and packet traces point to incomplete BREAK/RESET recovery in BaseAsyncProtocol._process_timeout_helper():

self._break_external()
await self._receive_packet(message)
self._break_in_progress = False
errors._raise_err(errors.ERR_CALL_TIMEOUT_EXCEEDED, timeout=timeout)

If the first packet received is the completed statement's DATA response rather than a MARKER, the helper raises DPY-4024 without completing RESET. The trace shows the server's RESET marker arriving without a client RESET response. The next call clears buffered packets and sends a request while the server is still waiting for RESET.

  1. Does your application call init_oracle_client()?

No. Thin mode.

  1. Include a runnable Python script that shows the problem.
import asyncio
import os
import platform
import sys
import time

import oracledb

PARAMS = dict(
    user=os.environ["ORACLE_USER"],
    password=os.environ["ORACLE_PASSWORD"],
    dsn=os.environ["ORACLE_DSN"],
)

async def main():
   
    for sleep_s in (0.55, 0.6, 0.7, 0.8, 0.9):
        async with oracledb.connect_async(**PARAMS) as conn:
            print("connection.version:", conn.version)
            conn.call_timeout = 500
            with conn.cursor() as cur:
                try:
                    await cur.execute(
                        "begin dbms_session.sleep(:s); end;", [sleep_s]
                    )
                except oracledb.DatabaseError as exc:
                    print(
                        f"  sleep={sleep_s}: call 1 {exc.args[0].full_code}, "
                        f"is_healthy={conn.is_healthy()}"
                    )

                start = time.monotonic()
                try:
                    await cur.execute("select 1 from dual")
                    print("    call 2 ok")
                except oracledb.DatabaseError as exc:
                    print(
                        f"    call 2 {exc.args[0].full_code} "
                        f"after {time.monotonic() - start:.2f}s"
                    )


asyncio.run(main())
主要语言
Python
星标
455
派生
119
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

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

oracle/python-oracledb 的其他 Issue

查看 oracle/python-oracledb 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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