Unregistering trace profile results in assertion failure
(1) By Roger Binns (rogerbinns) on 2025-01-27 18:35:58 [source]
If a tracer including SQLITE_TRACE_PROFILE is registered then startTime is initialized. When the statement completes, invokeProfileCallback is called based on the non-zero startTime. But if the tracer had been unregistered between when the statement started execution and this end time, the assertion failure results (but no other harm would happen).
Line numbers are from the 3.48.0 amalgamation with the assertion last.
sqlite3_step() sqlite3.c:91474
sqlite3Step() sqlite3.c:91425
invokeProfileCallback() sqlite3.c:90633
sqlite3.c:90633: invokeProfileCallback: Assertion `(db->mTrace & (SQLITE_TRACE_PROFILE|SQLITE_TRACE_XPROFILE))!=0' failed.
The assertion should perhaps check that db->trace.xV2 or db->xProfile are set before checking db->mTrace
(2) By Roger Binns (rogerbinns) on 2025-01-31 13:49:02 in reply to 1 [link] [source]
Bump. It indicates a code path that has not been tested in SQLite. To reproduce:
- Install a callback via
sqlite3_profileorsqlite3_trace_v2withSQLITE_TRACE_PROFILE(I do the latter) - Prepare a statement that returns some rows like
SELECT * FROM sqlite_schema - Call
sqlite3_step - Unregister the callback from earlier
- Keep calling
sqlite3_stepto exhaust all rows and finish the statement - You get the assertion failure above
I've had to disable some of my tests because of this.