Run bandersnatch under file locking and a timeout

* modules/openstack_project/manifests/pypi_mirror.pp: Bandersnatch
occasionally seems to livelock in a select poll loop at teardown.

https://bitbucket.org/pypa/bandersnatch/issue/52

As such this blocks subsequent runs of our wrapper script, filling
the log with useless tracebacks every 5 minutes while leaving the
mirror perpetually stale until someone comes along and notices. Work
around this unfortunate situation by setting a half hour timeout on
the process, and add a file lock to the invocation so that it will
not try to run more instances of the wrapper script until the
current one terminates.

Change-Id: I055b623801af3063d22b081eb9c9ef3634e5e5b5
This commit is contained in:
Jeremy Stanley 2014-09-17 14:01:01 +00:00
parent ad87293150
commit ddc7889df1

View File

@ -55,9 +55,13 @@ class openstack_project::pypi_mirror (
ensure => directory, ensure => directory,
} }
file { '/var/run/bandersnatch':
ensure => directory,
}
cron { 'bandersnatch': cron { 'bandersnatch':
minute => '*/5', minute => '*/5',
command => 'run-bandersnatch >>/var/log/bandersnatch/mirror.log 2>&1', command => 'flock -n /var/run/bandersnatch/mirror.lock timeout -k 2m 30m run-bandersnatch >>/var/log/bandersnatch/mirror.log 2>&1',
environment => 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin', environment => 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin',
} }