Attempt to add an async-ifying busy handler to SQLite3 storage driver.
mod_audit_status runs inside a timer.
14:59:10 sql debug [insert] INSERT INTO "prosody" ("host","user","store","key","type","value") VALUES ('EXAMPLE.COM','','audit_status','heartbeat','number','1729256350') ON CONFLICT ("host", "user","store", "key") DO UPDATE SET "type"='number', "value"='1729256350';
14:59:10 sql debug ASYNC WAITING [0]
14:59:10 sql debug SQL read transaction failure [function @mod_storage_sql.lua:204()]: database is locked
stack traceback:
[C]: in for iterator 'for iterator'
./util/sqlite3.lua:227: in function <./util/sqlite3.lua:216>
(...tail calls...)
plugins/mod_storage_sql.lua:230: in function <plugins/mod_storage_sql.lua:204>
[C]: in function 'xpcall'
./util/sqlite3.lua:281: in method '_transaction'
./util/sqlite3.lua:295: in method 'transaction'
plugins/mod_storage_sql.lua:204: in function <plugins/mod_storage_sql.lua:203>
(...tail calls...)
data/custom_plugins/share/lua/5.4/mod_audit_status.lua:37: in upvalue 'func'
./util/async.lua:149: in function <./util/async.lua:147>
14:59:10 runnerjuzu8hL-iPkI debug Calling 'error' watcher
14:59:10 runnerjuzu8hL-iPkI error Encountered error: ./util/async.lua:161: attempt to call a nil value (local 'f')
stack traceback:
./util/async.lua:161: in function 'prosody.util.async.default_runner_func'
./util/async.lua:149: in function <./util/async.lua:147>
14:59:10 runnerjuzu8hL-iPkI error Error in 'error' watcher: ./util/async.lua:159: ./util/async.lua:161: attempt to call a nil value (local 'f')
stack traceback:
./util/async.lua:161: in function 'prosody.util.async.default_runner_func'
./util/async.lua:149: in function <./util/async.lua:147>
stack traceback:
[C]: in function 'error'
./util/async.lua:159: in function <./util/async.lua:157>
[C]: in function 'xpcall'
./util/async.lua:38: in upvalue 'call_watcher'
./util/async.lua:64: in upvalue 'runner_continue'
./util/async.lua:90: in function <./util/async.lua:87>
[C]: in function 'xpcall'
./net/server_epoll.lua:188: in upvalue 'runtimers'
./net/server_epoll.lua:1179: in function 'prosody.net.server.loop'
[C]: in function 'xpcall'
./prosody:88: in local 'loop'
./prosody:93: in main chunk
[C]: in ?
trunk + async-lsqlite3 topic
Attempt to add an async-ifying busy handler to SQLite3 storage driver. mod_audit_status runs inside a timer. 14:59:10 sql debug [insert] INSERT INTO "prosody" ("host","user","store","key","type","value") VALUES ('EXAMPLE.COM','','audit_status','heartbeat','number','1729256350') ON CONFLICT ("host", "user","store", "key") DO UPDATE SET "type"='number', "value"='1729256350'; 14:59:10 sql debug ASYNC WAITING [0] 14:59:10 sql debug SQL read transaction failure [function @mod_storage_sql.lua:204()]: database is locked stack traceback: [C]: in for iterator 'for iterator' ./util/sqlite3.lua:227: in function <./util/sqlite3.lua:216> (...tail calls...) plugins/mod_storage_sql.lua:230: in function <plugins/mod_storage_sql.lua:204> [C]: in function 'xpcall' ./util/sqlite3.lua:281: in method '_transaction' ./util/sqlite3.lua:295: in method 'transaction' plugins/mod_storage_sql.lua:204: in function <plugins/mod_storage_sql.lua:203> (...tail calls...) data/custom_plugins/share/lua/5.4/mod_audit_status.lua:37: in upvalue 'func' ./util/async.lua:149: in function <./util/async.lua:147> 14:59:10 runnerjuzu8hL-iPkI debug Calling 'error' watcher 14:59:10 runnerjuzu8hL-iPkI error Encountered error: ./util/async.lua:161: attempt to call a nil value (local 'f') stack traceback: ./util/async.lua:161: in function 'prosody.util.async.default_runner_func' ./util/async.lua:149: in function <./util/async.lua:147> 14:59:10 runnerjuzu8hL-iPkI error Error in 'error' watcher: ./util/async.lua:159: ./util/async.lua:161: attempt to call a nil value (local 'f') stack traceback: ./util/async.lua:161: in function 'prosody.util.async.default_runner_func' ./util/async.lua:149: in function <./util/async.lua:147> stack traceback: [C]: in function 'error' ./util/async.lua:159: in function <./util/async.lua:157> [C]: in function 'xpcall' ./util/async.lua:38: in upvalue 'call_watcher' ./util/async.lua:64: in upvalue 'runner_continue' ./util/async.lua:90: in function <./util/async.lua:87> [C]: in function 'xpcall' ./net/server_epoll.lua:188: in upvalue 'runtimers' ./net/server_epoll.lua:1179: in function 'prosody.net.server.loop' [C]: in function 'xpcall' ./prosody:88: in local 'loop' ./prosody:93: in main chunk [C]: in ? trunk + async-lsqlite3 topic
Looks like lsqlite3 does not use https://www.lua.org/manual/5.4/manual.html#lua_pcallk so yielding out of the handler is unlikely to work.
Changes