[ARVADOS] updated: 1.1.0-102-g8d60bb5

Git user git at public.curoverse.com
Mon Nov 6 16:41:26 EST 2017


Summary of changes:
 services/crunch-run/crunchrun.go | 48 ++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 26 deletions(-)

       via  8d60bb5beda34d3837b4c9917576187abdbf986b (commit)
      from  e16989ed7897833f14766341838abd4e382a32a1 (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 8d60bb5beda34d3837b4c9917576187abdbf986b
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Mon Nov 6 16:41:05 2017 -0500

    12538: Refactor and assume arv-mount --unmount does all the hard work.
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/services/crunch-run/crunchrun.go b/services/crunch-run/crunchrun.go
index 7080ca2..557f30d 100644
--- a/services/crunch-run/crunchrun.go
+++ b/services/crunch-run/crunchrun.go
@@ -1253,34 +1253,30 @@ func (runner *ContainerRunner) getCollectionManifestForPath(mnt arvados.Mount, b
 	return extracted.Text, nil
 }
 
-func (runner *ContainerRunner) tryUnmount(umount *exec.Cmd) error {
-	umnterr := umount.Start()
-	if umnterr != nil {
-		runner.CrunchLog.Printf("Error: %v", umnterr)
-	}
-	go func() {
-		mnterr := umount.Wait()
-		if mnterr != nil {
-			runner.CrunchLog.Printf("Error running %v: %v", umount.Args, mnterr)
-		}
-	}()
-
-	timeout := time.NewTimer(9 * time.Second)
-	select {
-	case <-runner.ArvMountExit:
-		return nil
-	case <-timeout.C:
-		return fmt.Errorf("Timed out")
-	}
-}
-
 func (runner *ContainerRunner) CleanupDirs() {
 	if runner.ArvMount != nil {
-		if err := runner.tryUnmount(exec.Command("fusermount", "-u", runner.ArvMountPoint)); err != nil {
-			runner.CrunchLog.Printf("arv-mount not ended, will try force unmount: %v", err)
-			err = runner.tryUnmount(exec.Command("arv-mount", "--unmount-timeout=8", "--unmount", runner.ArvMountPoint))
-			if err != nil {
-				runner.CrunchLog.Printf("Error running arv-mount --unmount: %v", err)
+		delay := 8
+		umount := exec.Command("arv-mount", fmt.Sprintf("--unmount-timeout=%d", delay), "--unmount", runner.ArvMountPoint)
+		umnterr := umount.Start()
+		if umnterr != nil {
+			runner.CrunchLog.Printf("Error running %v: %v", umount.Args, umnterr)
+		} else {
+			// If arv-mount --unmount gets stuck for any reason, we
+			// don't want to wait for it.  Spin off the wait for
+			// child process so it doesn't block crunch-run.
+			go func() {
+				mnterr := umount.Wait()
+				if mnterr != nil {
+					runner.CrunchLog.Printf("Error running %v: %v", umount.Args, mnterr)
+				}
+			}()
+
+			timeout := time.NewTimer((delay + 1) * time.Second)
+			select {
+			case <-runner.ArvMountExit:
+				break
+			case <-timeout.C:
+				runner.CrunchLog.Printf("Timed out waiting for %v", umount.Args)
 			}
 		}
 		if rmerr := os.Remove(runner.ArvMountPoint); rmerr != nil {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list