tursodatabase/turso · error
transactions must overlap before queries start
Error message
transactions must overlap before queries start
What it means
The benchmark's batch runner begins a transaction on every session and then verifies that all sessions actually report an active (non-autocommit) transaction before running queries. If any connection is still in autocommit mode, the concurrent-transaction memory measurement would be invalid, so it fails with this error.
Source
Thrown at perf/memory/src/fts.rs:208
observer.on_phase(FtsPhase::Done);
}
async fn batch(&self, queries: usize) -> Result<RunResult> {
let transactions = matches!(self.config.execution, Execution::Transactions { .. });
let outcome = async {
let mut active = 0;
if transactions {
let begin = match self.config.mode {
JournalMode::Wal => "BEGIN",
JournalMode::Mvcc => "BEGIN CONCURRENT",
};
for session in &self.sessions {
session.begin(begin).await?;
}
for session in &self.sessions {
active += usize::from(!session.conn.is_autocommit()?);
}
ensure!(
active == self.sessions.len(),
"transactions must overlap before queries start"
);
}
let mut result = self.query_all(queries).await?;
if transactions {
for session in &self.sessions {
session.commit().await?;
ensure!(
session.conn.is_autocommit()?,
"COMMIT must end the transaction"
);
}
result.transactions = self.sessions.len();
result.max_active_transactions = active;
}
Ok(result)
}View on GitHub (pinned to 492c4a71cd)
Solutions
- Check each session's begin() result and is_autocommit() state immediately after BEGIN to find the offending connection
- Ensure the connections/driver version supports explicit transactions
- Reset or reopen sessions before each batch so no stale autocommit state remains
Defensive patterns
Strategy: validation
Validate before calling
for session in &self.sessions {
session.begin(begin).await?;
if session.conn.is_autocommit()? {
return Err(anyhow!("session failed to enter a transaction"));
}
} Try / catch
match batch_result {
Err(e) if e.to_string().contains("transactions must overlap") => {
// inspect per-session autocommit state, recreate sessions, retry
}
r => r?,
} Prevention
- Verify is_autocommit() right after BEGIN in your own harness
- Use fresh sessions per batch to avoid stale transaction state
- Keep driver and library versions in sync
When it happens
Trigger: Calling batch() with transactions enabled after a session's begin() silently failed to start a transaction — e.g. the BEGIN statement was a no-op, was rolled back, or the connection already committed internally.
Common situations: Driver/connection returns Ok from begin() but is_autocommit() still true due to a driver bug or unsupported transaction mode; running against a backend that ignores BEGIN; sessions were reused after an earlier error left them in autocommit.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- COMMIT must end the transaction
- index contains {} segment bytes, below requested minimum {};
- documents must be positive
- connections must be positive
- missing FTS segment data
AI-assisted analysis of tursodatabase/turso@492c4a71cd (2026-09-13).
Data as JSON: /api/errors/9da07d2b30d97b80.
Report an issue: GitHub.