[ARVADOS] updated: 71cbc637b9de58c326f09cc956d66e4c7b992927

git at public.curoverse.com git at public.curoverse.com
Tue Apr 7 11:19:32 EDT 2015


Summary of changes:
 sdk/cli/bin/crunch-job | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

       via  71cbc637b9de58c326f09cc956d66e4c7b992927 (commit)
       via  957a251e6fad0834b14bbaf7491d328802d9c97e (commit)
      from  807e72e0c7c4a023f3b2e580c9dbcdfd025106a3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 71cbc637b9de58c326f09cc956d66e4c7b992927
Author: Brett Smith <brett at curoverse.com>
Date:   Tue Apr 7 11:19:28 2015 -0400

    5642: Only use Docker memory limits when it supports --memory-swap.
    
    --memory-swap is pretty new (newer than 1.3.3), so we don't want to
    require it.  At the same time, we don't want to impose any memory
    limits if we can't use it, because killing subprocesses that exceed a
    --memory limit is too strict.  This commit arranges to use both
    --memory and --memory-swap only if the latter is available.

diff --git a/sdk/cli/bin/crunch-job b/sdk/cli/bin/crunch-job
index 9f575b0..a6ccebc 100755
--- a/sdk/cli/bin/crunch-job
+++ b/sdk/cli/bin/crunch-job
@@ -376,7 +376,7 @@ if (!defined $no_clear_tmp) {
 
 # If this job requires a Docker image, install that.
 my $docker_bin = "/usr/bin/docker.io";
-my ($docker_locator, $docker_stream, $docker_hash);
+my ($docker_locator, $docker_stream, $docker_hash, $docker_limitmem);
 if ($docker_locator = $Job->{docker_image_locator}) {
   ($docker_stream, $docker_hash) = find_docker_image($docker_locator);
   if (!$docker_hash)
@@ -408,6 +408,12 @@ fi
           .exit_status_s($?));
   }
 
+  # Determine whether this version of Docker supports memory+swap limits.
+  srun(["srun", "--nodelist=" . $node[0]],
+       ["/bin/sh", "-ec", "$docker_bin run --help | grep -qe --memory-swap="],
+      {fork => 1});
+  $docker_limitmem = ($? == 0);
+
   if ($Job->{arvados_sdk_version}) {
     # The job also specifies an Arvados SDK version.  Add the SDKs to the
     # tar file for the build script to install.
@@ -740,7 +746,14 @@ for (my $todo_ptr = 0; $todo_ptr <= $#jobstep_todo; $todo_ptr ++)
     {
       my $cidfile = "$ENV{CRUNCH_TMP}/$Jobstep->{arvados_task}->{uuid}-$Jobstep->{failures}.cid";
       $command .= "crunchstat -cgroup-root=/sys/fs/cgroup -cgroup-parent=docker -cgroup-cid=$cidfile -poll=10000 ";
-      $command .= "$docker_bin run --rm=true --attach=stdout --attach=stderr --attach=stdin -i --user=crunch --cidfile=$cidfile --sig-proxy --memory=\${MEMLIMIT}k --memory-swap=\${SWAPLIMIT}k ";
+      $command .= "$docker_bin run --rm=true --attach=stdout --attach=stderr --attach=stdin -i --user=crunch --cidfile=$cidfile --sig-proxy ";
+      # We only set memory limits if Docker lets us limit both memory and swap.
+      # Memory limits alone have been supported longer, but subprocesses tend
+      # to get SIGKILL if they exceed that without any swap limit set.
+      # See #5642 for additional background.
+      if ($docker_limitmem) {
+        $command .= "--memory=\${MEMLIMIT}k --memory-swap=\${SWAPLIMIT}k ";
+      }
 
       # Dynamically configure the container to use the host system as its
       # DNS server.  Get the host's global addresses from the ip command,

commit 957a251e6fad0834b14bbaf7491d328802d9c97e
Author: Brett Smith <brett at curoverse.com>
Date:   Tue Apr 7 11:08:19 2015 -0400

    5642: Fixup spacing.
    
    The previous version is functional but this can help prevent an
    accident in future development.

diff --git a/sdk/cli/bin/crunch-job b/sdk/cli/bin/crunch-job
index ebca7a5..9f575b0 100755
--- a/sdk/cli/bin/crunch-job
+++ b/sdk/cli/bin/crunch-job
@@ -734,7 +734,7 @@ for (my $todo_ptr = 0; $todo_ptr <= $#jobstep_todo; $todo_ptr ++)
         .q{&& MEM=$(awk '($1 == "MemTotal:"){print $2}' </proc/meminfo) }
         .q{&& SWAP=$(awk '($1 == "SwapTotal:"){print $2}' </proc/meminfo) }
         ."&& MEMLIMIT=\$(( (\$MEM * 95) / ($max_node_concurrent_tasks * 100) )) "
-        ."&& let SWAPLIMIT=\$MEMLIMIT+\$SWAP";
+        ."&& let SWAPLIMIT=\$MEMLIMIT+\$SWAP ";
     $command .= "&& exec arv-mount --by-id --allow-other $ENV{TASK_KEEPMOUNT} --exec ";
     if ($docker_hash)
     {

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list