Skip to content

DPY-5000: internal error: unknown protocol message under very subtile conditions #424

Closed
@AntonOvsyannikov

Description

@AntonOvsyannikov
  1. What versions are you using?
docker run --name oracle -d -p 1521:1521 -e ORACLE_PASSWORD=password gvenzl/oracle-xe

SELECT version FROM V$INSTANCE
│ VERSION      │
│ '21.0.0.0.0' │

platform.platform: Windows-10-10.0.22631-SP0
also reproduced at
platform.platform: Linux-5.15.153.1-microsoft-standard-WSL2-x86_64-with-glibc2.36

sys.maxsize > 2**32: True
platform.python_version: 3.9.12

oracledb.__version__: 2.4.1 (2.5.1 reproduced too)
sqlalchemy.__version__: 2.0.35

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

DPY-5000: internal error: unknown protocol message under very subtile conditions, see comments in code.

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

DPY-5000: internal error: unknown protocol message under very subtile conditions, see comments in code.

  1. Does your application call init_oracle_client()?

No

  1. Include a runnable Python script that shows the problem.
import os
import sqlalchemy as sa

os.environ["PYO_DEBUG_PACKETS"] = "1"
engine = sa.create_engine("oracle+oracledb://system:password@localhost/?service_name=XEPDB1", echo=True)

with engine.begin() as con:
    try:
        con.execute(sa.text('DROP USER "foo_test" CASCADE'))
    except Exception:
        pass
    con.execute(sa.text('CREATE USER "foo_test" QUOTA UNLIMITED ON USERS'))

with engine.begin() as con:
    try:
        con.execute(sa.text('DROP TABLE "foo_test"."import_test" CASCADE CONSTRAINTS'))
    except Exception:
        pass
    con.execute(sa.text('CREATE TABLE "foo_test"."import_test" ("id" NUMBER, "name" CLOB)'))
    con.execute(
        sa.text('INSERT INTO "foo_test"."import_test" ("id", "name") VALUES (:id, :name)'),
        {'id': '1', 'name': 'vasya'},
    )
    con.execute(sa.text('SELECT * FROM "foo_test"."import_test" FETCH FIRST 100 ROWS ONLY'))

with engine.begin() as con:
    con.execute(sa.text('DROP TABLE "foo_test"."import_test" CASCADE CONSTRAINTS'))

    # create statement should differ from first one
    con.execute(sa.text('CREATE TABLE "foo_test"."import_test" ("id" NUMBER, "name" VARCHAR2(100))'))

    con.execute(
        sa.text('INSERT INTO "foo_test"."import_test" ("id", "name") VALUES (:id, :name)'),
        {'id': '1', 'name': 'vasya'},
    )

    # select statement should be EXACTLY THE SAME as first one
    # caching issue?
    # !!!! The following causes DPY-5000: internal error: unknown protocol message type 0 at position 137
    con.execute(sa.text('SELECT * FROM "foo_test"."import_test" FETCH FIRST 100 ROWS ONLY'))

output
https://gist.github.com/AntonOvsyannikov/4deaea7388d1e1ebc49c9e676a8f10e1

if use fetch 101 (instead of 100) rows in second select script works fine
https://gist.github.com/AntonOvsyannikov/57bf73afb7a31345cdfb4fc693ab450e
see op 58

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions