connection.gettype with large type def throws error: dbms_pickler: raw variable length too long
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Start in src/oracledb/impl/thin/dbobject_cache.pyx at DBO_CACHE_SQL_GET_METADATA_FOR_NAME, the PL/SQL block that calls dbms_pickler.get_type_shape with a RAW tds out-bind, and trace where tds is decoded into the type metadata. The reporter suggests using the BLOB variant of get_type_shape; check how the returned descriptor is consumed before changing the bind type, since the decode path expects RAW semantics. Reproduce with a large UDT in Thin mode and confirm await connection.gettype() returns the type unchanged; the external Oracle DB requirement makes this hard for a newcomer.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
- What versions are you using?
Oracle database: 23.26.4.0.0
platform.platform: Linux-7.0.0-44-generic-x86_64-with-glibc2.43
sys.maxsize > 2**32: True
platform.python_version: 3.14.4
python-oracledb: 26.0.1
- Is it an error or a hang or a crash?
Error
- What error(s) or behavior you are seeing?
File "/pathto/mycode.py", line 123, in myfunc
await connection.gettype("mytype")
File "/pathto/oracledb/connection.py", line 2541, in wrapped_f
return await self._impl.process_async_operation(
File "src/oracledb/impl/base/connection.pyx", line 417, in process_async_operation
File "src/oracledb/impl/base/connection.pyx", line 413, in oracledb.base_impl.BaseConnImpl.process_async_operation
File "/pathto/oracledb/connection.py", line 264, in _gettype
obj_type_impl = yield from self._impl.get_type(self, name)
File "src/oracledb/impl/thin/connection.pyx", line 1004, in get_type
File "src/oracledb/impl/thin/dbobject_cache.pyx", line 605, in get_type
File "src/oracledb/impl/thin/dbobject_cache.pyx", line 494, in _lookup_type
File "/pathto/oracledb/cursor.py", line 211, in _execute
yield from impl.execute(self)
File "src/oracledb/impl/thin/cursor.pyx", line 295, in execute
File "src/oracledb/impl/base/connection.pyx", line 408, in oracledb.base_impl.BaseConnImpl.process_async_operation
File "src/oracledb/impl/thin/connection.pyx", line 645, in _process_async_operation_sub_op
File "src/oracledb/impl/thin/protocol.pyx", line 487, in _process_single_message
File "src/oracledb/impl/thin/protocol.pyx", line 491, in oracledb.thin_impl.BaseAsyncProtocol._process_single_message
File "src/oracledb/impl/thin/protocol.pyx", line 478, in _process_round_trip
File "src/oracledb/impl/thin/protocol.pyx", line 471, in oracledb.thin_impl.BaseAsyncProtocol._process_round_trip
File "src/oracledb/impl/thin/protocol.pyx", line 440, in _process_message
File "src/oracledb/impl/thin/messages/base.pyx", line 104, in oracledb.thin_impl.Message._check_and_raise_exception
oracledb.exceptions.DatabaseError: ORA-06502: PL/SQL: value or conversion error: raw variable length too long
ORA-06512: at "SYS.DBMS_PICKLER", line 403
ORA-06512: at line 9
Help: https://docs.oracle.com/error-help/db/ora-06502/
- Does your application call init_oracle_client()?
No (using Thin mode)
- Include a runnable Python script that shows the problem.
import oracledb
...
await connection.gettype("mytype")
So... connection.gettype() has been working fine for me, in Thin mode, for several years now... for smaller UDTs (User-Defined Types). But now I'm trying to work with a UDT that's significantly bigger than the others, causing this error to occur.
As I understand it, the python-oracledb code in question is:
src/oracledb/impl/thin/dbobject_cache.pyx
# SQL statements used within the DbObject type cache
cdef str DBO_CACHE_SQL_GET_METADATA_FOR_NAME = """
declare
t_Instantiable varchar2(3);
t_SuperTypeOwner varchar2(128);
t_SuperTypeName varchar2(128);
t_SubTypeRefCursor sys_refcursor;
t_Pos pls_integer;
begin
:ret_val := dbms_pickler.get_type_shape(:full_name, :oid,
:version, :tds, t_Instantiable, t_SuperTypeOwner,
t_SuperTypeName, :attrs_rc, t_SubTypeRefCursor);
A quick google indicates that the cause is a byte limit (4000 is the limit I guess?) on the RAW buffer size.
Switching to Thick mode isn't really an option for me (I switched to Thin mode several years ago, much happier with Thin mode in general, and I need the async functionality).
Simplifying the UDT isn't an option either.
From a bit of further googling, it looks like there's a different version of sys.dbms_pickler.get_type_shape in which the tds parameter is BLOB instead of RAW. And looks like, if python-oracledb could switch to calling that one, it would avoid the "raw variable length too long" error.
Any chance anyone could look into making this change in python-oracledb? Your help would be much appreciated. Keep up the amazing work, guys!
- Ngôn ngữ chính
- Python
- Star
- 458
- Fork
- 123
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của oracle/python-oracledb
-
Free-threading supportĐang mởenhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
oracle/python-oracledb#642 · 1 bình luận ·
-
bug patch available
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 76/100
oracle/python-oracledb#640 · 4 bình luận ·
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 57/100
oracle/python-oracledb#639 ·
-
Client Library or Database
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
oracle/python-oracledb#637 · 2 bình luận ·
-
Client Library or Database
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
oracle/python-oracledb#633 · 2 bình luận ·
Tất cả issue của oracle/python-oracledb
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug improve content
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
opensafely/documentation#2102 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
difficulty:1 documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
MakazhanAlpamys/Soup#3533 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
onyx-dot-app/onyx#18730 ·
Maintainer thường phản hồi trong vòng 1 ngày