process-upload lockfile has bad permission

Bug #52025 reported by Malcolm Cleaton
4
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Medium
Celso Providelo

Bug Description

We hit a problem today with Soyuz, after a reboot of drescher; a lockfile was left lying around with permissions such that only one of the relevant lp_* users could play with it.

We use file-locking for our locking, so that locks will automatically be released when things crash hard, but this doesn't help if the lockfiles don't have the right permissions. We need to ensure we create lockfiles with sufficient write access for all users who share the lock, so that hard crashes won't require manual lock frobbing.

Changed in soyuz:
assignee: nobody → malcolmcleaton
importance: Untriaged → Medium
status: Unconfirmed → Confirmed
Revision history for this message
Colin Watson (cjwatson) wrote :

I'm taking the liberty of unassigning Malcolm from this, as I doubt he's going to be working on it any more.

This is biting us in process-upload at the moment. How about:

--- process-upload.py.orig 2007-02-10 12:44:58.000000000 +0000
+++ process-upload.py 2007-02-10 12:45:24.000000000 +0000
@@ -28,7 +28,9 @@
     options = readOptions()
     log = logger(options, "process-upload")

+ old_umask = os.umask(0002)
     locker = GlobalLock(_default_lockfile, logger=log)
+ os.umask(old_umask)
     try:
         locker.acquire()
     except LockAlreadyAcquired:

Changed in soyuz:
assignee: malcolmcleaton → nobody
Revision history for this message
Colin Watson (cjwatson) wrote :

This won't quite work, as the lock file has group lp_buildd if lp_buildd creates it, and lp_queue isn't a member of that group.

One simple solution, and to my mind the cleanest, would be to move the lock file to a Launchpad-specific directory (rather than /var/lock) which is setgid lp_lock; then all lock files created there would have the proper group ownership, and if created with umask 0002 would be group-writable.

Revision history for this message
Celso Providelo (cprov) wrote :

it's hurting us again, lp_queue (sources) & lp_buildd (binaries) 'process-upload' are conflicting harder.

I will check if this requirement is going to fit in our new script infrastructure as well.

Changed in soyuz:
assignee: nobody → cprov
status: Confirmed → In Progress
Revision history for this message
Celso Providelo (cprov) wrote :

Thinking about the overall problem again, I can't see any reason for blocking simultaneous run of process-upload using different policies:

 * 'insecure' runs by cron (lp_queue)
 * 'security' runs by cron (lp_queue)
 * 'buildd' is tied to buildd-slave-scanner. (lp_buildd)
 * 'sync' runs on demand (lp_queue)

I do agree that simultaneous runs of p-u using the same policy may indicate problems considering the current production setup. However, the conflicts are, mostly, generated by 'insecure' & 'buildd' simultaneous runs, which clearly perform unrelated tasks.

We can avoid permission overlap dealing and further setup complexity by encoding the policy name in the lockfile name, then each upload incoming branch will continue to be protected but not blocked by activity in other ones.

Revision history for this message
Celso Providelo (cprov) wrote :
Revision history for this message
Celso Providelo (cprov) wrote :

RF 3994

Changed in soyuz:
status: In Progress → Fix Committed
Revision history for this message
Celso Providelo (cprov) wrote :

released sometime ago

Changed in soyuz:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.