Subject: Re: Errors with pkgsrc locking mechanism
To: Raymond Meyer <raymond.meyer@rambler.ru>
From: Lars Nordlund <lars.nordlund@hem.utfors.se>
List: tech-pkg
Date: 07/30/2006 12:34:44
On Mon, 10 Jul 2006 02:03:19 +0100
Raymond Meyer <raymond.meyer@rambler.ru> wrote:
> When multiple packages try to build the same package as part of their
> dependancy, they fail in the following way:

I suppose you are building several packages simultaneously in the same
pkgsrc tree? From my experience this is not safe. Mainly two reasons:

- /var/db/pkg is not locked. Two packages being installed at the same
time might register themself in a common package they both depend on.
This can result in a corrupted database.

- Several packages have the same distfile. If these packages are built
at the same time, multiple fetches will try to write to the same file.

> => Lock is held by pid 12281

I do not know what other people think about the pkgsrc locking
mechanism, but IMHO it should be removed. Not only does it simply not
work throughout pkgsrc because of the reasons stated above, I have also
seen locks being grabbed when they should not. For example when the
other make process has finished building and starts to install. Then the
first make is released from the lock and starts to build.. With
unspecified result of course... (from 2+ year old memory. Have not used
it since then. Problem could have been corrected of course).


Best regards,
	Lars Nordlund