[ARVADOS] created: 2b2adb421b9b82b75fe8a635442dfe8e1fab775a
git at public.curoverse.com
git at public.curoverse.com
Tue May 27 10:39:53 EDT 2014
at 2b2adb421b9b82b75fe8a635442dfe8e1fab775a (commit)
commit 2b2adb421b9b82b75fe8a635442dfe8e1fab775a
Author: Tim Pierce <twp at curoverse.com>
Date: Tue May 27 10:38:29 2014 -0400
2865: collect garbage after each GET and PUT.
Quick fix for Keep OOM errors: reclaim memory aggressively.
Fixes #2865.
diff --git a/services/keep/src/keep/keep.go b/services/keep/src/keep/keep.go
index 001e66e..3a782f1 100644
--- a/services/keep/src/keep/keep.go
+++ b/services/keep/src/keep/keep.go
@@ -17,6 +17,7 @@ import (
"os"
"os/signal"
"regexp"
+ "runtime"
"strconv"
"strings"
"syscall"
@@ -352,6 +353,13 @@ func GetBlockHandler(resp http.ResponseWriter, req *http.Request) {
}
block, err := GetBlock(hash)
+
+ // Garbage collect after each GET. Fixes #2865.
+ // TODO(twp): review Keep memory usage and see if there's
+ // a better way to do this than blindly garbage collecting
+ // after every block.
+ defer runtime.GC()
+
if err != nil {
// This type assertion is safe because the only errors
// GetBlock can return are CorruptError or NotFoundError.
@@ -370,6 +378,10 @@ func GetBlockHandler(resp http.ResponseWriter, req *http.Request) {
}
func PutBlockHandler(resp http.ResponseWriter, req *http.Request) {
+ // Garbage collect after each PUT. Fixes #2865.
+ // See also GetBlockHandler.
+ defer runtime.GC()
+
hash := mux.Vars(req)["hash"]
log.Printf("%s %s", req.Method, hash)
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list