mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 14:32:28 +03:00
build: set open file limit based on how many apps are being processed
When running `fdroid build --all` on a buildserver with thousands of apps, it was frequently hitting the open file limit. This increases the open file limit based on how many apps are being process. It is doubled to provide a margin of safety. There are probably open file leaks which ideally would be fixed, but this is also useful to make things more resilient to all the random stuff apps include in their build systems.
This commit is contained in:
parent
19af92c982
commit
2b6825ccfd
2 changed files with 14 additions and 1 deletions
|
@ -23,6 +23,7 @@ import shutil
|
||||||
import glob
|
import glob
|
||||||
import subprocess
|
import subprocess
|
||||||
import re
|
import re
|
||||||
|
import resource
|
||||||
import tarfile
|
import tarfile
|
||||||
import traceback
|
import traceback
|
||||||
import time
|
import time
|
||||||
|
@ -1120,6 +1121,19 @@ def main():
|
||||||
if not apps:
|
if not apps:
|
||||||
raise FDroidException("No apps to process.")
|
raise FDroidException("No apps to process.")
|
||||||
|
|
||||||
|
# make sure enough open files are allowed to process everything
|
||||||
|
soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE)
|
||||||
|
if len(apps) > soft:
|
||||||
|
try:
|
||||||
|
soft = len(apps) * 2
|
||||||
|
if soft > hard:
|
||||||
|
soft = hard
|
||||||
|
resource.setrlimit(resource.RLIMIT_NOFILE, (soft, hard))
|
||||||
|
logging.debug(_('Set open file limit to {integer}')
|
||||||
|
.format(integer=soft))
|
||||||
|
except (OSError, ValueError) as e:
|
||||||
|
logging.warning(_('Setting open file limit failed: ') + str(e))
|
||||||
|
|
||||||
if options.latest:
|
if options.latest:
|
||||||
for app in apps.values():
|
for app in apps.values():
|
||||||
for build in reversed(app.builds):
|
for build in reversed(app.builds):
|
||||||
|
|
|
@ -31,7 +31,6 @@ else
|
||||||
echo "No virtualization is used."
|
echo "No virtualization is used."
|
||||||
fi
|
fi
|
||||||
sudo /bin/chmod -R a+rX /var/lib/libvirt/images
|
sudo /bin/chmod -R a+rX /var/lib/libvirt/images
|
||||||
ulimit -n 2048
|
|
||||||
echo 'maximum allowed number of open file descriptors: ' `ulimit -n`
|
echo 'maximum allowed number of open file descriptors: ' `ulimit -n`
|
||||||
ls -ld /var/lib/libvirt/images
|
ls -ld /var/lib/libvirt/images
|
||||||
ls -l /var/lib/libvirt/images || echo no access
|
ls -l /var/lib/libvirt/images || echo no access
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue