RocksDB: serial inserts stop responding at a fixed row count (307k on 3.3.0-beta.4, 449k on 3.2.4); SurrealKV unaffected
What component does this affect?
SurrealDB Server
Describe the bug
On a fresh RocksDB datastore, serial INSERT batches of 1,000 rows into a SCHEMALESS table with one secondary index stop completing at a repeatable row count:
- 3.3.0-beta.4: the request after 307,000 acknowledged rows never returns.
- 3.2.4: the same happens after 449,000 rows.
While it is stuck:
GET /versionfrom inside the container also stops answering, so host port forwarding is not the cause.- CPU use is low, memory stays far below the container limit, and the cgroup OOM counters are zero.
- All threads wait on futexes or condition variables.
The process does not stop within a 5 s grace period and has to be killed. After a restart, exactly the acknowledged rows are present (307,000), and the unacknowledged batch is absent.
The same workload on SurrealKV completes 1,000,000 rows and reopens with a matching count. On the memory engine it completes 500,000.
Re-verified on 2026-09-24 with the script below:
- RocksDB printed
no response after 307000 acknowledged rows, and/versioninside the container timed out while CPU was at 0% and memory at 324 MiB of 2 GiB. - A 5 s stop ended in a kill (exit 137), and the restarted datastore counted exactly 307,000 rows.
- The same script on SurrealKV completed 500,000 rows in 13 s.
Earlier controls on the same binary, each on a fresh datastore (3.3.0-beta.4 unless stated):
| Change | Outcome |
|---|---|
| Stop at 300,000 rows | Completes and reopens |
Experimental surrealism,files enabled, no module loaded |
Same stall at 307,000 |
SURREAL_ROCKSDB_WRITE_BUFFER_SIZE=16777216 |
Stall at 104,000 |
| Grouped commit, pipelined writes or background WAL flush disabled (separately) | Each still stalls at 307,000 |
| Minimum write buffers to merge = 1 | Stall at 307,000 |
| No secondary index | 600,000 completes; a larger run stalls at 623,000 |
Embedded CLI (surreal sql against rocksdb:), no HTTP server |
307 batches acknowledged, then no progress within 90 s; reopen count 307,000 |
| SurrealKV | 1,000,000 completes; reopen count matches |
The boundary moves with the write buffer size and with removing the index, which points at buffered-write or flush behaviour. That is only a hypothesis: the release binaries are stripped, so the stacks do not identify the blocked function.
Steps to reproduce
- Start a fresh server in a Linux ARM64 container limited to 2 CPUs and 2 GiB of memory, without swap:
surreal start --user root --pass root --query-timeout 20s --transaction-timeout 15s rocksdb:/data/bench.db - Run this standard-library script (
python3 rocksdb_ingest_stall.py http://127.0.0.1:8000 500000). It signs in, defines the table and index, then sends acknowledged 1,000-row batches over one HTTP connection:
#!/usr/bin/env python3
"""Serial 1,000-row inserts into a fresh indexed table until a request stops completing.
Usage: python3 rocksdb_ingest_stall.py [http://127.0.0.1:8000] [rows]
Server: surreal start --user root --pass root --query-timeout 20s \
--transaction-timeout 15s rocksdb:/data/bench.db
Standard library only; all data is synthetic.
"""
import http.client, json, sys, time
from urllib.parse import urlparse
url = urlparse(sys.argv[1] if len(sys.argv) > 1 else "http://127.0.0.1:8000")
rows = int(sys.argv[2]) if len(sys.argv) > 2 else 500_000
def request(conn, path, body, token=None):
headers = {"Accept": "application/json", "Surreal-NS": "lab", "Surreal-DB": "lab"}
if token:
headers["Authorization"] = "Bearer " + token
conn.request("POST", path, body, headers)
response = conn.getresponse()
data = response.read()
if response.status != 200:
raise RuntimeError((response.status, data[:300]))
return json.loads(data)
conn = http.client.HTTPConnection(url.hostname, url.port or 8000, timeout=25)
token = request(conn, "/signin", json.dumps({"user": "root", "pass": "root"}))["token"]
request(conn, "/sql", "DEFINE NAMESPACE lab; USE NS lab; DEFINE DATABASE lab; USE DB lab;"
" DEFINE TABLE item SCHEMALESS; DEFINE INDEX scope ON item FIELDS relationship;", token)
started = time.time()
for i in range(0, rows, 1000):
sql = (f"INSERT INTO item (array::range({i},{min(i + 1000, rows)}).map(|$i| {{"
"id:type::record('item',$i),relationship:'R'+<string>($i%100),active:$i%3!=0,"
"value:$i,payload:'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'})) RETURN NONE;")
try:
result = request(conn, "/sql", sql, token)
assert all(r.get("status") == "OK" for r in result), result
except Exception as error:
print(f"no response after {i} acknowledged rows ({time.time() - started:.0f} s): {error!r}")
sys.exit(1)
if (i + 1000) % 50_000 == 0:
print(f"{i + 1000} rows acknowledged ({time.time() - started:.0f} s)", flush=True)
print(f"completed {rows} rows")Each batch is:
INSERT INTO item (array::range(<i>, <i+1000>).map(|$i| {
id: type::record('item', $i),
relationship: 'R' + <string>($i % 100),
active: $i % 3 != 0,
value: $i,
payload: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
})) RETURN NONE;The table has DEFINE INDEX scope ON item FIELDS relationship;.
Expected behaviour
Ingestion continues. Failing that, the server returns a bounded error and stays responsive, as it does on SurrealKV.
SurrealDB version
surrealdb-3.3.0-beta.4, official Linux ARM64 release binary, SHA-2563169afcd7f31753fd0a91a9dfe2e460bd2cf007777b0ae51a002428c8984ea4c.- Also
surrealdb-3.2.4+20260803.93ab219, SHA-2568e5c0a366ee36a57a36d32a04674128692ab1a9aefd3d2be4efba0ca6b873469.
Environment:
- Docker Desktop Linux VM on macOS ARM64, with a Linux-managed volume and no architecture emulation.
- The binary was mounted into a Debian-based Python image rather than the official SurrealDB image.
- Not yet reproduced on a dedicated Linux host.
Is there an existing issue for this?
I searched the open and closed issues and found no report of RocksDB ingestion stopping at a fixed row count.
Could this be a bug with your application?
No. The reproduction is plain SurrealQL over the HTTP /sql endpoint from the standard-library script above, with no application code involved.
Source: surrealdb/surrealdb