← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~abentley/launchpad/builder-limits into lp:launchpad/devel

 

Aaron Bentley has proposed merging lp:~abentley/launchpad/builder-limits into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


= Summary =
Fix bug #676657: recipe builds can use too much memory

== Proposed fix ==
Restrict virtual memory use by a recipe build to 1 GB.  This will allow some
swapping, but not excessive swapping.

== Pre-implementation notes ==
None

== Implementation details ==
There are really two problems:
1. Recipe builds use too much memory.
2. The build farm behaves badly when builds use too much memory.

Both issues should be addressed.  This change addresses 2 by killing builds
that use excessive amounts of memory before they can cause real harm.  (The
builders only have 1GB of memory on average.)

== Tests ==
None

== Demo and Q/A ==
Create a recipe using qtwebkit.
See https://code.launchpad.net/~rohangarg/+recipe/qtwebkit

Request a build of the recipe.  It should die with a memory error.


= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/canonical/buildd/buildrecipe
-- 
https://code.launchpad.net/~abentley/launchpad/builder-limits/+merge/41211
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~abentley/launchpad/builder-limits into lp:launchpad/devel.
=== modified file 'lib/canonical/buildd/buildrecipe'
--- lib/canonical/buildd/buildrecipe	2010-09-30 20:22:15 +0000
+++ lib/canonical/buildd/buildrecipe	2010-11-18 18:23:36 +0000
@@ -11,6 +11,7 @@
 import os
 import pwd
 import re
+from resource import RLIMIT_AS, setrlimit
 import socket
 from subprocess import call, Popen, PIPE
 import sys
@@ -206,6 +207,7 @@
 
 
 if __name__ == '__main__':
+    setrlimit(RLIMIT_AS, (1000000000, -1))
     builder = RecipeBuilder(*sys.argv[1:])
     if builder.buildTree() != 0:
         sys.exit(RETCODE_FAILURE_BUILD_TREE)