From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Cl=C3=A9ment?= 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 Message-ID: <87k1ponc62.fsf@lassieur.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34941) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fgofK-0002Qx-9Q for bug-guix@gnu.org; Sat, 21 Jul 2018 05:59:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fgofG-0001vh-BR for bug-guix@gnu.org; Sat, 21 Jul 2018 05:59:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:45202) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fgofG-0001vd-5m for bug-guix@gnu.org; Sat, 21 Jul 2018 05:59:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fgofF-0002ie-Uq for bug-guix@gnu.org; Sat, 21 Jul 2018 05:59:01 -0400 Sender: "Debbugs-submit" Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fgoeN-0001if-Hr for bug-guix@gnu.org; Sat, 21 Jul 2018 05:58:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fgoeK-0001e6-HP for bug-guix@gnu.org; Sat, 21 Jul 2018 05:58:07 -0400 Received: from mail.lassieur.org ([83.152.10.219]:60320) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fgoeK-0001dS-57 for bug-guix@gnu.org; Sat, 21 Jul 2018 05:58:04 -0400 Received: from rodion (88.191.118.83 [88.191.118.83]) by mail.lassieur.org (OpenSMTPD) with ESMTPSA id 94315a1b (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256:NO) for ; Sat, 21 Jul 2018 09:57:58 +0000 (UTC) List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: 32234@debbugs.gnu.org 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 =3D 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=C3=A9ment [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