Chakra Build System

  • Status Assigned
  • Percent Complete
    0%
  • Task Type Feature Request
  • Category Backend / Core
  • Assigned To Luca Giambonini (AlmAck)
  • Operating System All
  • Severity Medium
  • Priority Normal
  • Reported Version 1.0
  • Due in Version Undecided
  • Due Date Undecided
  • Votes 0
  • Private No
Attached to Project: Chakra Build System
Opened by Adrián Chaves (Gallaecio) - 2016-05-22
Last edited by Samir Benmendil (Ram-Z) - 2016-09-23

FS#1590 - Handle race condition between package upload and database update

From #chakra-devel:
[11:37:15] <Gallaecio> Hmm… Running ‘upload.sh -r desktop’ to upload freexl 1.0.2, I succeeded at uploading the package, but could not update the database because almack had it locked. If I try to run the command again now, I am told that I cannot because the package is in desktop already, but it is not in the desktop database. What should I do?
[…]
[11:39:09] <Gallaecio> I’ll try removing it and reuploading.
[…]
[11:39:59] <Gallaecio> No luck :(
[11:40:43] <Gallaecio> Let’s go with a pkgrel++
[11:41:56] <Gallaecio> pkgrel++ did the trick
[…]
[11:43:16] <tetris4> Gallaecio: you might want to report that on our bugtracker, as a buildsystem feature request

This task does not depend on any other tasks.

Adrián Chaves (Gallaecio)
Sunday, 22 May 2016, 09:57 GMT
Output that I got:

1) Successful upload and unsuccessful database update:

[gallaecio@stable: ~/desktop (master=)]$ upload.sh -r desktop

>>> Upload Package(s) v2.9 - freexl-x86_64

:: Checking for rsync OK
:: Checking account settings
:: server OK
:: user OK
:: port OK

:: You are about to upload (1) packages and (0) signatures to «desktop-x86_64»:
/chakra/_repo/stable/freexl-1.0.2-1-x86_64.pkg.tar.xz

:: Do you really want to upload the package(s)? (y/n) y

:: locking «desktop-x86_64»

:: [SERVER] lock database


::SUCCESS::
DONE
DONE
:: uploading to «desktop-x86_64»building file list ...
1 file to consider
freexl-1.0.2-1-x86_64.pkg.tar.xz
21.96K 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=0/1)

sent 22.07K bytes received 39 bytes 14.74K bytes/sec
total size is 21.96K speedup is 0.99
DONE


:: [SERVER] add package(s)


:: adding this pkg: freexl-1.0.2-1-x86_64.pkg.tar.xz
Database is locked with /srv/www/packages/desktop/x86_64/desktop.joblock which is owned by almack
FAIL
::

:: [SERVER] add package(s)


:: adding this pkg: freexl-1.0.2-1-x86_64.pkg.tar.xz
Database is locked with /srv/www/packages/desktop/x86_64/desktop.joblock which is owned by almack

:: unlocking «desktop-x86_64»

:: [SERVER] unlock database


::SUCCESS::
DONE


2) Unssuccessful retry right away

[gallaecio@stable: ~/desktop (master=)]$ upload.sh -r desktop

>>> Upload Package(s) v2.9 - desktop-x86_64

:: Checking for rsync OK
:: Checking account settings
:: server OK
:: user OK
:: port OK

:: The following packages:
freexl-1.0.2-1
:: already exists in desktop. If you are rebuilding or updating this
:: package, you should either change the version, or increment the
:: pkgrel.
:: Aborting!


3) Unsuccessful removal and re-upload

[gallaecio@stable: ~/desktop (master=)]$ remove.sh freexl
:: Checking for rsync OK
:: Checking account settings
:: server OK
:: user OK
:: port OK

:: searching for «freexl» in «desktop-x86_64»

:: (2) packages match your search criteria and (1) signatures:
freexl-1.0.1-1-x86_64.pkg.tar.xz
freexl-1.0.1-1-x86_64.pkg.tar.xz.sig
freexl-1.0.2-1-x86_64.pkg.tar.xz

:: Do you really want to remove these 2 package(s) and 1 signature(s) ? (y/n) y

:: removing freexl-1.0.1-1-x86_64.pkg.tar.xz from «desktop»==> Extracting database to a temporary location...
==> Searching for package 'freexl'...
-> Removing existing entry 'freexl-1.0.1-1'...
==> Searching for package 'freexl'...
==> ERROR: Package matching 'freexl' not found.
==> Searching for package 'freexl'...
==> ERROR: Package matching 'freexl' not found.
==> Creating updated database file '/srv/www/packages/desktop/x86_64/desktop.db.tar.gz'
------- Akabei Create Database - started at Sun May 22 09:39:26 2016 -------

Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.

terminate called after throwing an instance of 'ArchiveException'
what(): Can't unlink already-existing object


:: [SERVER] remove package(s)


:: removing this pkg(s): ['freexl', 'freexl', 'freexl']
:: Set Owner to: packagers-junior of: /srv/www/packages/desktop/x86_64/desktop.db.tar.gz
:: oh no! chown error: uid: 1008 gid: 1016 path: /srv/www/packages/desktop/x86_64/desktop.db.tar.xz
:: oh no! chmod 0x664 error
:: Set Owner to: packagers-junior of: /srv/www/packages/desktop/x86_64/desktop.db.tar.xz
:: oh no! chown error: uid: 1008 gid: 1016 path: /srv/www/packages/desktop/x86_64/desktop.db.tar.xz.sig
:: oh no! chmod 0x664 error
:: Set Owner to: packagers-junior of: /srv/www/packages/desktop/x86_64/desktop.db.tar.xz.sig
::SUCCESS::
:: downloading and signing the databasegpg: signing failed: No pinentry
gpg: signing failed: No pinentry
gpg: signing failed: No pinentry
gpg: signing failed: No pinentry
DONE
building file list ...
2 files to consider

sent 64 bytes received 16 bytes 53.33 bytes/sec
total size is 3.29M speedup is 41,125.93
DONE

real 0m8.341s
user 0m0.087s
sys 0m0.073s


>>> All done


[gallaecio@stable: ~/desktop (master=)]$ upload.sh -r desktop

>>> Upload Package(s) v2.9 - desktop-x86_64

:: Checking for rsync OK
:: Checking account settings
:: server OK
:: user OK
:: port OK

:: The following packages:
freexl-1.0.2-1
:: already exists in desktop. If you are rebuilding or updating this
:: package, you should either change the version, or increment the
:: pkgrel.
:: Aborting!


4) Successful upload after a pkgrel++

[gallaecio@stable: ~/desktop/freexl (master *=)]$ upload.sh -r desktop

>>> Upload Package(s) v2.9 - freexl-x86_64

:: Checking for rsync OK
:: Checking account settings
:: server OK
:: user OK
:: port OK

:: You are about to upload (1) packages and (0) signatures to «desktop-x86_64»:
/chakra/_repo/stable/freexl-1.0.2-2-x86_64.pkg.tar.xz

:: Do you really want to upload the package(s)? (y/n) y

:: locking «desktop-x86_64»

:: [SERVER] lock database


::SUCCESS::
DONE
DONE
:: uploading to «desktop-x86_64»building file list ...
1 file to consider
freexl-1.0.2-2-x86_64.pkg.tar.xz
21.97K 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=0/1)

sent 22.08K bytes received 39 bytes 14.75K bytes/sec
total size is 21.97K speedup is 0.99
DONE
==> Extracting database to a temporary location...
==> Adding package '/srv/www/packages/desktop/x86_64/freexl-1.0.2-2-x86_64.pkg.tar.xz'
-> Computing checksums...
-> Creating 'desc' db entry...
-> Creating 'depends' db entry...
==> Creating updated database file '/srv/www/packages/desktop/x86_64/desktop.db.tar.gz'
------- Akabei Create Database - started at Sun May 22 09:41:47 2016 -------

Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.

terminate called after throwing an instance of 'ArchiveException'
what(): Can't unlink already-existing object


:: [SERVER] add package(s)


:: adding this pkg: freexl-1.0.2-2-x86_64.pkg.tar.xz
:: Set Owner to: packagers-junior of: /srv/www/packages/desktop/x86_64/freexl-1.0.2-2-x86_64.pkg.tar.xz
:: no signature found for freexl-1.0.2-2-x86_64.pkg.tar.xz
:: Set Owner to: packagers-junior of: /srv/www/packages/desktop/x86_64/desktop.db.tar.gz
:: oh no! chown error: uid: 1008 gid: 1016 path: /srv/www/packages/desktop/x86_64/desktop.db.tar.xz
:: oh no! chmod 0x664 error
:: Set Owner to: packagers-junior of: /srv/www/packages/desktop/x86_64/desktop.db.tar.xz
::SUCCESS::
DONE
:: Moving packages to «/var/cache/pacman/pkg»

:: cleaning «local-stable.db.tar» DONE
:: downloading and signing the databasegpg: signing failed: No pinentry
gpg: signing failed: No pinentry
gpg: signing failed: No pinentry
gpg: signing failed: No pinentry
DONE
building file list ...
2 files to consider

sent 64 bytes received 16 bytes 53.33 bytes/sec
total size is 3.29M speedup is 41,129.09

:: unlocking «desktop-x86_64»

:: [SERVER] unlock database


::SUCCESS::
DONE

real 0m9.532s
user 0m0.160s
sys 0m0.060s

Loading...