[ARVADOS] created: 1.3.0-1747-gef25437d7

Git user git at public.curoverse.com
Tue Oct 15 14:26:41 UTC 2019


        at  ef25437d74cd7c2ce9ba4df2364c1da3d06b8bbb (commit)


commit ef25437d74cd7c2ce9ba4df2364c1da3d06b8bbb
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Tue Oct 15 10:24:02 2019 -0400

    15721: Fix 503 on API.MaxConcurrentRequests==0 and empty response.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/lib/controller/handler_test.go b/lib/controller/handler_test.go
index d34df7f2c..5dc0b1e86 100644
--- a/lib/controller/handler_test.go
+++ b/lib/controller/handler_test.go
@@ -65,21 +65,27 @@ func (s *HandlerSuite) TestConfigExport(c *check.C) {
 	s.cluster.SystemRootToken = "secret"
 	s.cluster.Collections.BlobSigning = true
 	s.cluster.Collections.BlobSigningTTL = arvados.Duration(23 * time.Second)
-	req := httptest.NewRequest("GET", "/arvados/v1/config", nil)
-	resp := httptest.NewRecorder()
-	s.handler.ServeHTTP(resp, req)
-	c.Check(resp.Code, check.Equals, http.StatusOK)
-	c.Check(resp.Header().Get("Access-Control-Allow-Origin"), check.Equals, `*`)
-	c.Check(resp.Header().Get("Access-Control-Allow-Methods"), check.Matches, `.*\bGET\b.*`)
-	c.Check(resp.Header().Get("Access-Control-Allow-Headers"), check.Matches, `.+`)
-	var cluster arvados.Cluster
-	c.Log(resp.Body.String())
-	err := json.Unmarshal(resp.Body.Bytes(), &cluster)
-	c.Check(err, check.IsNil)
-	c.Check(cluster.ManagementToken, check.Equals, "")
-	c.Check(cluster.SystemRootToken, check.Equals, "")
-	c.Check(cluster.Collections.BlobSigning, check.DeepEquals, true)
-	c.Check(cluster.Collections.BlobSigningTTL, check.Equals, arvados.Duration(23*time.Second))
+	for _, method := range []string{"GET", "OPTIONS"} {
+		req := httptest.NewRequest(method, "/arvados/v1/config", nil)
+		resp := httptest.NewRecorder()
+		s.handler.ServeHTTP(resp, req)
+		c.Check(resp.Code, check.Equals, http.StatusOK)
+		c.Check(resp.Header().Get("Access-Control-Allow-Origin"), check.Equals, `*`)
+		c.Check(resp.Header().Get("Access-Control-Allow-Methods"), check.Matches, `.*\bGET\b.*`)
+		c.Check(resp.Header().Get("Access-Control-Allow-Headers"), check.Matches, `.+`)
+		if method == "OPTIONS" {
+			c.Check(resp.Body.String(), check.HasLen, 0)
+			continue
+		}
+		var cluster arvados.Cluster
+		c.Log(resp.Body.String())
+		err := json.Unmarshal(resp.Body.Bytes(), &cluster)
+		c.Check(err, check.IsNil)
+		c.Check(cluster.ManagementToken, check.Equals, "")
+		c.Check(cluster.SystemRootToken, check.Equals, "")
+		c.Check(cluster.Collections.BlobSigning, check.DeepEquals, true)
+		c.Check(cluster.Collections.BlobSigningTTL, check.Equals, arvados.Duration(23*time.Second))
+	}
 }
 
 func (s *HandlerSuite) TestProxyDiscoveryDoc(c *check.C) {
diff --git a/sdk/go/httpserver/request_limiter.go b/sdk/go/httpserver/request_limiter.go
index 23e6e016d..888945312 100644
--- a/sdk/go/httpserver/request_limiter.go
+++ b/sdk/go/httpserver/request_limiter.go
@@ -76,8 +76,9 @@ func (h *limiterHandler) Max() int {
 func (h *limiterHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
 	if cap(h.requests) == 0 {
 		atomic.AddInt64(&h.count, 1)
+		defer atomic.AddInt64(&h.count, -1)
 		h.handler.ServeHTTP(resp, req)
-		atomic.AddInt64(&h.count, -1)
+		return
 	}
 	select {
 	case h.requests <- struct{}{}:

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list