Repository navigation
Description
Level: bindings and engine. GraphBatch.create_vertex begins, commits, and on failure rolls back its own transaction, and ArcadeData#8828 (merged 2026-10-03T09:54Z) extends that to every exception. GraphBatch.create_vertices opens its transaction inside the engine (beginTx in createVerticesWithRetry) and rolls back only for a retryable NeedRetryException. Any other failure, such as a DuplicatedKeyException on a unique index, leaves the transaction active. db.is_transaction_active() stays True after the batch is closed, a following db.command(...) outside any transaction is accepted instead of raising Transaction not begun, the row is visible to reads, and it is gone after close() and reopen.
Repro
The script prints to stdout. The JVM's own log lines go to stderr and are discarded by the command below.
uv venv .venv
uv pip install --python .venv/bin/python arcadedb_embedded-26.10.1.dev0-cp312-cp312-manylinux_2_34_x86_64.whl
.venv/bin/python repro-15-create-vertices-leaves-transaction.py 2>/dev/null"""A failed GraphBatch.createVertices (not a retryable error) leaves its transaction open; create_vertex cleans up after itself."""
import os
import tempfile
import arcadedb_embedded as arcade
from arcadedb_embedded.jvm import start_jvm
start_jvm(heap_size="2g")
path = os.path.join(tempfile.mkdtemp(prefix="hb15-"), "db")
db = arcade.create_database(path)
db.command("sql", "CREATE VERTEX TYPE Person")
db.command("sql", "CREATE PROPERTY Person.id INTEGER")
db.command("sql", "CREATE INDEX ON Person (id) UNIQUE")
db.command("sql", "CREATE DOCUMENT TYPE Note")
with db.graph_batch() as batch:
try:
batch.create_vertex("Person", id=1)
batch.create_vertex("Person", id=1)
except arcade.ArcadeDBError:
pass
print("after a failed create_vertex : transaction active =", db.is_transaction_active())
try:
batch.create_vertices("Person", [{"id": 2}, {"id": 2}])
except arcade.ArcadeDBError as e:
print("create_vertices raised :", type(e).__name__)
print("after a failed create_vertices : transaction active =", db.is_transaction_active())
print("after the batch closed : transaction active =", db.is_transaction_active())
db.command("sql", "INSERT INTO Note SET text = 'written outside any transaction'") # accepted, not refused
print("Note rows visible now :", db.count_type("Note"))
db.close()
db = arcade.open_database(path)
print("after close and reopen : Person =", db.count_type("Person"), ", Note =", db.count_type("Note"))
db.close()Output
Wheel arcadedb_embedded-26.10.1.dev0-cp312-cp312-manylinux_2_34_x86_64.whl with its bundled JRE (OpenJDK 25.0.4.1), JPype 1.7.1, and Python 3.12.13. The engine build the wheel reports through com.arcadedb.Constants is 26.10.1-SNAPSHOT (build 04bb03ebec07fce19101595d65ca1e3bdf516755), an ancestor of upstream cecb369df9. The repository is at f92ac1381c8335249a6fde644cbf04594f6d6391, and the installed Python sources are identical to bindings/python/src/arcadedb_embedded/ at that commit.
after a failed create_vertex : transaction active = False
create_vertices raised : ArcadeDBError
after a failed create_vertices : transaction active = True
after the batch closed : transaction active = True
Note rows visible now : 1
after close and reopen : Person = 1 , Note = 0
Cause
In the engine, createVerticesWithRetry calls beginTx() (GraphBatch.java L662) and has a single catch (final NeedRetryException e) (GraphBatch.java L678), whose body is the only place that rolls back. The same call through raw Java objects, with no bindings code, leaves the transaction active.
In the bindings, create_vertices wraps the call in except Exception and raises ArcadeDBError without checking the transaction (graph_batch.py L181-L185), where create_vertex rolls back in its except (graph_batch.py L139-L148).
Expected
After a failed create_vertices the database has no active transaction that the caller did not start, like after a failed create_vertex and a failed insert_many.
Proposed fix
In the bindings, roll back a transaction that this call found inactive and left active, on every exit, as PR ArcadeData#8828 does for create_vertex. A run-time monkeypatch of this wrapper makes the repro show transaction active = False after the failed call and after the batch closes, and the bare write is then refused:
--- a/bindings/python/src/arcadedb_embedded/graph_batch.py
+++ b/bindings/python/src/arcadedb_embedded/graph_batch.py
def create_vertices(self, type_name, count_or_properties):
self._check_not_closed()
+ was_active = self._java_db.isTransactionActive()
try:
...
except Exception as e:
+ if not was_active and self._java_db.isTransactionActive():
+ self._java_db.rollback()
raise ArcadeDBError(The engine fix is the same shape: catch RuntimeException in createVerticesWithRetry, roll back, and rethrow.
Related issues
ArcadeData#7882 and PR ArcadeData#8828 (merged 2026-10-03T09:54Z) fix this class of leak for insert_many and GraphBatch.create_vertex, and the PR's completeness table lists the Java bridge classes as having no begin or commit of their own, which is true of the bridge but not of the engine call that create_vertices makes. Nothing else found.
In this repository's tracker no issue is about this. The searches for create_vertices, GraphBatch, and transaction found no issue about a leaked transaction.
Related reports from the same review: #117 (results read after close).
Activity
tae898 commentedon Oct 3, 2026
The engine half (
GraphBatch.createVerticesrolls back only for aNeedRetryException) is filed upstream as ArcadeData#9040, with a Java repro on Temurin 25 and 21 and a tested direction. The wrapper half is in #130.Lifecycle: results and records keep their Database and raise once it …
benchmarks: the instrument changes for the 26.10.1 re-pin campaign, w…