[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#32234: Cuirass: The SQLite built in busy handler might block the Fib
From: |
Clément Lassieur |
Subject: |
bug#32234: Cuirass: The SQLite built in busy handler might block the Fibers scheduler |
Date: |
Sat, 21 Jul 2018 11:57:57 +0200 |
User-agent: |
mu4e 1.0; emacs 26.1 |
Hi,
I'm trying to understand why Berlin web API times out[1].
I think the SQlite built in busy handler may block the Fibers scheduler.
We use "PRAGMA busy_timeout = 30000;", which is an alternative to
calling sqlite3_busy_timeout(), whose description[2] is:
This routine sets a busy handler that sleeps for a specified amount
of time when a table is locked. The handler will sleep multiple
times until at least "ms" milliseconds of sleeping have
accumulated. After at least "ms" milliseconds of sleeping, the
handler returns 0 which causes sqlite3_step() to return SQLITE_BUSY.
To me this sounds like non-cooperative and non-resumable code.
A solution would be to set a custom handler through
sqlite3_busy_handler[3] that would be Fibers compatible, i.e. it would
let the scheduler schedule other fibers instead of just sleeping, using
Fibers 'sleep' procedure[4].
WDYT?
Clément
[1]: https://bugs.gnu.org/32233.
[2]: https://www.sqlite.org/c3ref/busy_timeout.html
[3]: https://www.sqlite.org/c3ref/busy_handler.html
[4]: https://github.com/wingo/fibers/wiki/Manual#user-content-index-sleep
- bug#32234: Cuirass: The SQLite built in busy handler might block the Fibers scheduler,
Clément Lassieur <=