unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#32234: Cuirass: The SQLite built in busy handler might block the Fibers scheduler
@ 2018-07-21  9:57 Clément Lassieur
  2018-07-23  9:18 ` Ludovic Courtès
  2018-08-06 19:27 ` bug#32234: [PATCH 1/2] utils: Avoid deadlock when WITH-CRITICAL-SECTION calls are nested Clément Lassieur
  0 siblings, 2 replies; 17+ messages in thread
From: Clément Lassieur @ 2018-07-21  9:57 UTC (permalink / raw)
  To: 32234

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2018-08-27 15:14 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-21  9:57 bug#32234: Cuirass: The SQLite built in busy handler might block the Fibers scheduler Clément Lassieur
2018-07-23  9:18 ` Ludovic Courtès
2018-07-23 13:42   ` Clément Lassieur
2018-07-23 14:57     ` Ludovic Courtès
2018-07-23 16:18       ` Clément Lassieur
2018-07-23 20:11         ` Ludovic Courtès
2018-08-06 19:27 ` bug#32234: [PATCH 1/2] utils: Avoid deadlock when WITH-CRITICAL-SECTION calls are nested Clément Lassieur
2018-08-06 19:27   ` bug#32234: [PATCH 2/2] database: Serialize all database accesses in a thread Clément Lassieur
2018-08-06 19:35     ` Clément Lassieur
2018-08-19 14:06     ` Ludovic Courtès
2018-08-26 14:07       ` Clément Lassieur
2018-08-26 21:16         ` Ludovic Courtès
2018-08-27 13:47           ` Clément Lassieur
2018-08-27 12:41         ` Danny Milosavljevic
2018-08-27 13:18           ` Clément Lassieur
2018-08-27 14:23             ` Danny Milosavljevic
2018-08-27 15:05               ` Clément Lassieur

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).