-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pkg-update: locking issues on concurrent invokes #2200
Comments
Noticed 654c36f introduced an flock() and that consecutive ops->open and ops->create calls between the update processes are impossible to lock from the database end so preliminary creation of a /var/db/pkg/REPO.sqlite-lock file seems to do the trick: one instance fails, but the other updates and so consecutive calls (e.g. pkg-rquery) are fine and don't cause a cascade of more updates being attempted inline by other tools since the database is gone and in need of an update. POC PR tomorrow. |
The lock was working but still clobbering the database... surprisingly the nasty bit appears to be the recovery that messes with the other end which also recreated the database and this makes both of them fail eventually: pkg/libpkg/repo/binary/update.c Lines 565 to 569 in 507aaa8
|
Noticed this while working on freebsd#2200. Move the restore into the sanity check to avoid passing a NULL pointer and trying to restore a database that wasn't moved.
Noticed this while working on #2200. Move the restore into the sanity check to avoid passing a NULL pointer and trying to restore a database that wasn't moved.
Please bear with me :)
pkg-update may be called by other commands internally so having a bit of automation around the package database and checking for updates it can happen that pkg-update appears to run concurrently but its sqlite database locking is not safe so it starts to produce at least two types of spurious errors.
On the FreeBSD repo:
On the OPNsense repo (much smaller):
pkg version is 1.19.2, but I can test on newer version (even though test is trivial). With pointer in the right direction I can also try and see if this can be fixed.
The text was updated successfully, but these errors were encountered: