Skip to content

Segfault (SIGSEGV) in thin-mode fetch_df_all/fetch_df_batches when a result column has undefined length (internal_size = None) #597

Description

@vucenovic

1. What versions are you using?

python-oracledb version: 4.0.1

Thin or Thick mode: Thin

Python version and platform:

platform.platform: Linux-6.18.33.2-microsoft-standard-WSL2-x86_64-with-glibc2.39
sys.maxsize > 2**32: True
platform.python_version: 3.12.3
oracledb.version: 4.0.1

Oracle Database version: 19.19.0.0.0 (Thin mode; clientversion() N/A)

2. Is it an error or a hang or a crash?

Crash

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

In Thin mode, Connection.fetch_df_all() / Connection.fetch_df_batches() crashes the interpreter with a segmentation fault when the result set contains a VARCHAR column of undefined length (reported as internal_size = None / display_size = None in cursor.description) and 3 or more rows are returned.

With ≤ 2 rows it does not crash.
If the column has a defined length (e.g. CAST(NULL AS VARCHAR2(10))) it does not crash at any row count.
Fetching the same query the ordinary way (cursor.execute() + fetchall()) works fine and returns the values.
Occurs with and without a requested_schema argument.

4. Does your application call init_oracle_client()?

No

5. Include a runnable Python script that shows the problem.

import oracledb, faulthandler
faulthandler.enable()

conn = oracledb.connect(user="...", password="...", dsn="host:1521/service")  # thin mode

# describe: c -> DB_TYPE_VARCHAR, internal_size=None, display_size=None
cur = conn.cursor()
cur.execute("SELECT NULL AS c FROM dual CONNECT BY LEVEL <= 3")
print(cur.description)
print(cur.fetchall())   # works: [(None,), (None,), (None,)]

# SIGSEGV (process exits 139):
conn.fetch_df_all("SELECT NULL AS c FROM dual CONNECT BY LEVEL <= 3")

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions