You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
libsql-sqlite3: Make libsql_stmt_interrupt() abort an in-flight step (#2248)
libsql_stmt_interrupt() set a per-statement isInterrupted flag, but the
VDBE execution loop only ever checked the connection-wide
db->u1.isInterrupted. A statement already executing inside
sqlite3_step()
therefore ran to completion regardless of the request; the flag was only
observed at the next step() entry.
Check p->isInterrupted alongside db->u1.isInterrupted at both VDBE
interrupt-check sites so an interrupt requested mid-execution aborts the
running statement promptly with SQLITE_INTERRUPT, without touching the
connection-wide interrupt state (other statements keep running). Set and
clear the flag atomically, mirroring sqlite3_interrupt(), since the
request may come from another thread.
Tests:
- test/interruptstmt.test: deterministic regression via a new
sqlite_stmt_interrupt_count test hook, covering the in-loop check and
the connection-flag-stays-clear property.
- test/interrupttest.c: standalone multi-threaded test of the real
cross-thread case (interrupt a step() in flight) and statement-level
granularity. Build and run with `make interrupttest`.
0 commit comments