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

Oracle: a compiled read of a property past 32 KB over two or more rows crashes the session

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
50/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
backend, databases

调研方向

Start with drivine/cypher/sql/oracle_cypher_compiler.py at property_of, then inspect _property in drivine/cypher/sql/sql_cypher_compiler.py and the existing Oracle compiler tests. Reproduce the two-row, 40 KB property read on Oracle and compare the compiled SQL with the safe extended-JSON form described in the issue. Done means porting the named drivine4j test cases and confirming the session stays open across all three statements.

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

描述

Port of liberation-data/drivine4j#255.

On Oracle, a compiled Cypher read of a node property longer than about 32 KB, over two or more rows, crashes the server session. The client sees DPY-4011 (the database closed the connection), on the read or on the next statement on that connection.

await pm.query(spec("CREATE (:CyWrite {id: 1}), (:CyWrite {id: 2})"))
await pm.query(spec("MATCH (n:CyWrite) SET n.a = $a", {"a": "x" * 40_000}))
await pm.query(spec("MATCH (n:CyWrite) RETURN n.a ORDER BY n.id"))  # DPY-4011, here or on the next statement

Probed on origin/main (Oracle Free 23.26, gvenzl/oracle-free:23-faststart), each statement new text on one connection: it crashed in 2 of 2 runs.

Where. RETURN n.a compiles to JSON_QUERY(n1.props, '$.a' RETURNING JSON): property_of at drivine/cypher/sql/oracle_cypher_compiler.py:184, called for a node's and a relationship's property in _property at drivine/cypher/sql/sql_cypher_compiler.py:2780 and :2782.

The server bug. JSON_QUERY(<JSON column>, path RETURNING JSON) of a scalar text past 32 KB, for each of two rows, crashes the session (ORA-07445 ksmem_malloc, ORA-00600 [17114]/[17147]). In SQL*Plus with no client library: plain SELECT JSON_QUERY(props, '$.a' RETURNING JSON) FROM t over two rows crashed 4/4, and so did dot notation t.props.a, JSON_SERIALIZE(JSON_QUERY(...)), JSON_ARRAY(..., JSON_QUERY(...)) and JSON_VALUE over it. Safe (0/4 each): JSON(JSON_QUERY(props, '$.a' RETURNING CLOB)) and the extended-JSON read below, also inside JSON_ARRAY and through a subquery. A 40 KB array of short texts read RETURNING JSON did not crash. RETURNING CLOB writes a whole double 2.0 as 2, so it can't be used for every value.

The fix in drivine4j. A property that is itself an item of a RETURN or a WITH (returned or passed on) is read through its text, as extended JSON, so a whole double stays a double:
JSON(JSON_QUERY(JSON_SERIALIZE(JSON_TRANSFORM(props, KEEP '$.a') RETURNING CLOB EXTENDED), '$.a' RETURNING CLOB) EXTENDED).
It reads props once. A guard that kept short values on the plain read (CASE WHEN JSON_VALUE(props, '$.a.length()') > 8000 THEN … ELSE JSON_QUERY(…) END, or a COALESCE) was crash-safe but returned wrong rows: Oracle dropped another table's label test where a select-list expression read props twice (reproduced in SQL*Plus, MATCH (p:Person {name: 'Laurence'})-[r]->(k:Person) WITH p, r, k.name AS first ... returned a Movie). Reads elsewhere (WHERE, sort keys that aren't items, a property nested in a larger item such as [n.a] or n {.a}) are unchanged, and so is a read beside a variable-length walk, where Oracle has closed the session over more involved reads of the row.

Tests to port. drivine4j's CypherWriteOracleTest "a property past 32 KB read on two nodes leaves the session open" (one connection, three rounds of new statement text: RETURN n.a ORDER BY n.id, WITH n.id AS id, n.a AS a ... RETURN [id, a], then a count to check the session), OracleItemPropertyTest (compiled SQL), and the spec case "A property past 32 KB read on two nodes" (writes.yaml).

主要语言
Python
星标
1
派生
0
平均合并
1 小时 16 分钟
30 天内合并 PR
74

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

liberation-data/drivine-python 的其他 Issue

查看 liberation-data/drivine-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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