Find a file
Eelco Dolstra d05bf04444 Treat SQLITE_PROTOCOL as SQLITE_BUSY
In the Hydra build farm we fairly regularly get SQLITE_PROTOCOL errors
(e.g., "querying path in database: locking protocol").  The docs for
this error code say that it "is returned if some other process is
messing with file locks and has violated the file locking protocol
that SQLite uses on its rollback journal files."  However, the SQLite
source code reveals that this error can also occur under high load:

  if( cnt>5 ){
    int nDelay = 1;                      /* Pause time in microseconds */
    if( cnt>100 ){
      VVA_ONLY( pWal->lockError = 1; )
      return SQLITE_PROTOCOL;
    }
    if( cnt>=10 ) nDelay = (cnt-9)*238;  /* Max delay 21ms. Total delay 996ms */
    sqlite3OsSleep(pWal->pVfs, nDelay);
  }

i.e. if certain locks cannot be not acquired, SQLite will retry a
number of times before giving up and returing SQLITE_PROTOCOL.  The
comments say:

  Circumstances that cause a RETRY should only last for the briefest
  instances of time.  No I/O or other system calls are done while the
  locks are held, so the locks should not be held for very long. But
  if we are unlucky, another process that is holding a lock might get
  paged out or take a page-fault that is time-consuming to resolve,
  during the few nanoseconds that it is holding the lock.  In that case,
  it might take longer than normal for the lock to free.
  ...
  The total delay time before giving up is less than 1 second.

On a heavily loaded machine like lucifer (the main Hydra server),
which often has dozens of processes waiting for I/O, it seems to me
that a page fault could easily take more than a second to resolve.
So, let's treat SQLITE_PROTOCOL as SQLITE_BUSY and retry the
transaction.

Issue NixOS/hydra#14.
2013-10-16 14:19:59 +02:00
corepkgs Lower xz compression level 2013-09-02 13:32:51 +02:00
doc Version was called 1.6, not 1.6.0 2013-09-10 17:48:11 +02:00
misc Rename nix-worker to nix-daemon 2012-10-03 17:59:23 -04:00
perl Don't apply the CPU affinity hack to nix-shell (and other Perl programs) 2013-09-06 16:36:56 +02:00
scripts nix-shell: Fix bash completion 2013-10-14 15:28:43 +02:00
src Treat SQLITE_PROTOCOL as SQLITE_BUSY 2013-10-16 14:19:59 +02:00
tests Adjust to the NixOS/Nixpkgs merge 2013-10-11 10:57:23 +02:00
.gitignore Rename nix-worker to nix-daemon 2012-10-03 17:59:23 -04:00
AUTHORS * Put something in here. 2004-11-07 20:30:02 +00:00
bootstrap.sh bootstrap: Simplify & make more robust. 2011-09-06 12:11:05 +00:00
build.nix Add an experimental nix-make file 2012-05-21 09:43:01 -04:00
configure.ac Turn on -Wall 2013-08-19 11:41:15 +02:00
COPYING * Change this to LGPL to keep the government happy. 2006-04-25 16:41:06 +00:00
dev-shell Hack to clean up tests/test-tmp 2013-08-21 12:53:46 +02:00
INSTALL * Autoconf / Automake configuration and building. 2003-04-04 16:14:56 +00:00
Makefile.am Garbage collector: Don't follow symlinks arbitrarily 2013-07-12 14:03:36 +02:00
nix.spec.in Add gzip support for channel unpacking 2013-07-12 11:29:37 +02:00
README * Install documentation in $(docdir) (i.e. share/doc/nix). 2008-11-19 13:19:09 +00:00
release.nix Build Fedora 18 RPMs 2013-05-08 14:41:35 +02:00
substitute.mk Prevent config.h from being clobbered 2013-03-08 01:27:04 +01:00
version Bump version number 2013-09-10 17:41:49 +02:00

Nix is a purely functional package manager.  For installation and
usage instructions, please read the manual, which can be found in
`docs/manual/manual.html', and additionally at the Nix website at
<http://nixos.org/>.


Acknowledgments

This product includes software developed by the OpenSSL Project for
use in the OpenSSL Toolkit (http://www.OpenSSL.org/).