Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Dec 2012 06:53:57 -0800
From:      Jeremy Chadwick <jdc@koitsu.org>
To:        Mathias.Picker@virtual-earth.de
Cc:        bapt@FreeBSD.org, freebsd-ports@freebsd.org
Subject:   Re: pkgng: sqlite: database is locked
Message-ID:  <20121212145357.GA49439@icarus.home.lan>

next in thread | raw e-mail | index | archive | help
(Please keep me CC'd as I'm not subscribed to the list)


> ===>   Registering installation for MuSE-0.9.2_14
> Installing MuSE-0.9.2_14... done
> pkg: sqlite: database is locked
> 
> which results in muse not being registered in the pkg database...

This worries me.  It appears to indicate that the installation of the
package (i.e. sticking files into /usr/local) happens first, followed by
an attempted exclusive lock of the pkg sqlite DB, which then failed --
thus leaving files laying around in /usr/local.

If that is the case (and boy do I hope it isn't) then that logic is 100%
backwards.  The DB exlock should happen first, and if the DB exlock
fails[1] then things should abort.  Otherwise you'll end up with files
installed on your filesystem which aren't registered in the pkg DB, and
that is unacceptable.

This also worries me:

> ... This persists between reboots, and for fresh pkg runs. 

What kind of locking mechanism is being used here?  flock(2) LOCK_EX
would not survive a reboot, but a filesystem-based dotlock would.

This really needs investigation and not be swept under the rug.  And
please don't tell me "you have the source, go look at it" -- I would
much rather the authors who are familiar with the code look at it.  :-)

[1]: I don't advocate that the locking mechanism should block
indefinitely, but there should be some kind of retry attempt at a
specific interval (i.e. try 5 times, with 1 second delays) before giving
up -- and something on-screen should be printed/shown every time an
attempt to lock is made.  Maybe that already happens, I don't know, I
don't use pkg.

This also makes me wonder if there's a SIGINT handler for a person
hitting Ctrl-C in the middle of that operation and if proper clean-up is
done afterward.

-- 
| Jeremy Chadwick                                   jdc@koitsu.org |
| UNIX Systems Administrator                http://jdc.koitsu.org/ |
| Mountain View, CA, US                                            |
| Making life hard for others since 1977.             PGP 4BD6C0CB |




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20121212145357.GA49439>