ZhYQ1 opened a new issue, #437:
URL: https://github.com/apache/hugegraph-ai/issues/437

   ### Bug Type (问题类型)
   
   exception / error (异常报错)
   
   ### Before submit
   
   - [x] I had searched in the 
[issues](https://github.com/apache/hugegraph-ai/issues) and found no similar 
issues.
   
   ### Environment (环境信息)
   
   server version could get from rest-api (http://localhost:8080/versions)
   Markdown Editor
   Markdown input: edit mode selected.
   Write / Preview
   Python / OS / hugegraph-ai version or commit / SQLite setup
   - Python / OS / hugegraph-ai version or commit: ontogeny 
0.3.0(ontogeny/pyproject.toml);Python 3.12 + SQLAlchemy 2.x(异步),受影响代码在 
ontogeny/server/ontogeny/action/(runtime.py、models.py)
   - SQLite setup: 受影响为 SQLite(demo / 测试 / 无 advisory lock 的部署,sqlite+aiosqlite 
引擎,in-memory 或文件库);Postgres 路径已用 pg_advisory_xact_lock 串行化同 key 调用者
   - 测试:ontogeny/tests/test_action.py(in-memory SQLite 引擎 + 种子包;受影响为 
TestExecute、TestOutbox,并新增 TestSqliteIdempotencyConcurrency)
   
   ### Expected & Actual behavior (期望与实际表现)
   
   Expected behavior: Concurrent requests with the same (action, principal, 
idempotency_key) on SQLite should remain idempotent—executing side effects once 
and returning the same committed revision.   
   Actual behavior: On SQLite (which lacks advisory locks), concurrent same-key 
replays can all observe the uncommitted "not exists" state, execute duplicate 
effects, and hit the (action, principal, idempotency_key) unique index on 
insert, raising an uncaught IntegrityError (or SQLITE_BUSY under 
multi-connection writes) that surfaces as HTTP 500. 
   
   ### Vertex/Edge example (问题点 / 边数据举例)
   
   ```javascript
   Not related to specific graph vertex/edge data. Minimal concurrent 
reproduction: run 8 concurrent ActionRuntime.execute calls across independent 
sessions on one runtime (e.g., asyncio.gather(*[call() for _ in range(8)])), 
each executing release-production-order for PO-1002 with 
idempotency_key="op-123". Without the fix, concurrent callers pass the "not 
exists" check and trigger an uncaught IntegrityError (HTTP 500) / duplicate 
execution.
   ```
   
   ### Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
   
   ```javascript
   Concurrently invoke ActionRuntime.execute with the same idempotency_key 
(e.g., asyncio.gather with 8 calls executing release-production-order for 
PO-1002 with idempotency_key="op-123"), which triggers the race and HTTP 500 / 
duplicate execution.
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to