executemany() with /*+ append_values */ and strings over 32767 bytes stores another row's value or raises ORA-03106 (Thin)
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
- 55/100
Hướng nghiên cứu
Start with the runnable script in the issue, which isolates the failure to Thin mode executemany() with the append_values hint and LONG-bound strings over 32767 bytes. Compare those results with conventional inserts and hinted batches of shorter strings, then trace the Thin mode array-bind and direct-path handling. Done means the script stores each row’s correct value or returns a clear error instead of corrupting data or raising ORA-03106.
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?
database: 23.26.1.0.0 (Oracle Database 23ai Enterprise Edition, container-registry.oracle.com/database/enterprise)
platform.platform: Linux-6.18.54.1-microsoft-standard-WSL2-x86_64-with-glibc2.41
sys.maxsize > 2**32: True
platform.python_version: 3.14.10
oracledb.__version__: 26.1.0
We first saw it on Oracle Database 19.17 (RAC on Exadata) with the Rust driver (rust-oracledb 26.0.0-beta.5),
which shares the Thin protocol implementation: same ORA-03106 there.
- Is it an error or a hang or a crash?
Both an error and silent wrong data.
- What error(s) or behavior you are seeing?
executemany() of INSERT /*+ append_values */ ... VALUES (:1, :2) into a CLOB column, when a batch contains a
string longer than 32767 bytes (bound as LONG):
- if other rows in the batch are short, there is no error, but the long row gets another row's value (the
first row of the batch is repeated); - if several rows are long,
ORA-03106: fatal two-task communication protocol error.
The same batches without the hint (conventional insert), and batches whose values are all <= 32767 bytes with the
hint, are inserted correctly. Output of the script below (expected: row N has the letter of row N and its size):
database: 23.26.1.0.0
OK [100, 5000] conventional 1:100x'a' 2:5000x'b'
OK [100, 5000] append_values 1:100x'a' 2:5000x'b'
OK [100, 40000] conventional 1:100x'a' 2:40000x'b'
BAD [100, 40000] append_values 1:100x'a' 2:100x'a'
OK [40000, 100] conventional 1:40000x'a' 2:100x'b'
BAD [40000, 100] append_values 1:40000x'a' 2:40000x'a'
OK [40000, 40000, 40000] conventional 1:40000x'a' 2:40000x'b' 3:40000x'c'
BAD [40000, 40000, 40000] append_values ORA-03106: fatal two-task communication protocol error
I have not tested Thick mode (no Instant Client available here), so I don't know whether this is a Thin mode
issue or a database restriction on direct-path inserts with LONG binds. Even if direct path cannot take LONG binds,
I would expect an error rather than another row's value being stored.
- Does your application call init_oracle_client()?
No (Thin mode).
- Include a runnable Python script that shows the problem.
import os
import oracledb
TABLE = "append_values_long_test"
def connect():
return oracledb.connect(
user=os.environ["PYO_USER"],
password=os.environ["PYO_PASSWORD"],
dsn=os.environ["PYO_DSN"],
)
with connect() as conn:
print("database:", conn.version)
cursor = conn.cursor()
cursor.execute(f"drop table if exists {TABLE} purge")
cursor.execute(f"create table {TABLE} (id number, c clob)")
cases = [
[100, 5000], # all values <= 32767 bytes
[100, 40000], # second value > 32767 bytes
[40000, 100],
[40000, 40000, 40000],
]
for sizes in cases:
for hint in ("", "/*+ append_values */ "):
# new connection for each case, as ORA-03106 may leave it unusable
with connect() as conn:
cursor = conn.cursor()
cursor.execute(f"truncate table {TABLE}")
rows = [(i + 1, "abcdefghij"[i] * size) for i, size in enumerate(sizes)]
try:
cursor.executemany(
f"insert {hint}into {TABLE} (id, c) values (:1, :2)", rows
)
conn.commit()
cursor.execute(
f"select id, dbms_lob.getlength(c), substr(c, 1, 1) "
f"from {TABLE} order by id"
)
result = " ".join(f"{i}:{n}x'{ch}'" for i, n, ch in cursor)
except oracledb.Error as e:
result = str(e).splitlines()[0]
expected = " ".join(
f"{i + 1}:{size}x'{'abcdefghij'[i]}'" for i, size in enumerate(sizes)
)
label = "append_values" if hint else "conventional"
status = "OK " if result == expected else "BAD"
print(f"{status} {str(sizes):<22} {label:<14} {result}")
with connect() as conn:
conn.cursor().execute(f"drop table {TABLE} purge")
- 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
-
DPY-3040 on AR8MSWIN1256 (charset id 560) when reading DbObject string attributes in Thin modeĐang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 57/100
oracle/python-oracledb#636 · 1 bình luận ·
-
Thin mode: an outputtypehandler redefining a CLOB as DB_TYPE_LONG misreads the reply when the statement is cachedCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
oracle/python-oracledb#634 ·
-
Thin mode: segfault when a cached query is executed again after its first execute failed with ORA-01438Có thể đã có người làm @jhchong0405 đã nhận 3 ngày trước. Đang mở
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 38/100
oracle/python-oracledb#631 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
oracle/python-oracledb#630 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
oracle/python-oracledb#629 ·
Tất cả issue của oracle/python-oracledb
Issue tương tự
-
SslLibrary crashes with unhandled OSError: port/proto not found on non-standard SSL portsCó thể đã có người làm @himanchalkaushale đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
OWASP/Nettacker#1884 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
A-connection-core C-enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/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 88/100
aws-samples/sample-per-model-bedrock#869 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Spec: say that included_antigen_sources gates LENS labels; do not merge it into antigen kindsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
fzn0x/watchtower#17 ·