[ARVADOS] created: 1.2.0-318-g6938e8cff

Git user git at public.curoverse.com
Thu Nov 8 11:09:38 EST 2018


        at  6938e8cff1632d597cfbd333e4d5176805b628c6 (commit)


commit 6938e8cff1632d597cfbd333e4d5176805b628c6
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Thu Nov 8 10:55:47 2018 -0500

    14458: Drain errors channel on failure case instead of accumulating separately
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/lib/controller/fed_collections.go b/lib/controller/fed_collections.go
index 38cf409e6..2121480e1 100644
--- a/lib/controller/fed_collections.go
+++ b/lib/controller/fed_collections.go
@@ -209,7 +209,7 @@ func (h *collectionFederatedRequestHandler) ServeHTTP(w http.ResponseWriter, req
 	wg := sync.WaitGroup{}
 	pdh := m[1]
 	success := make(chan *http.Response)
-	errorChan := make(chan error, h.handler.Cluster.RequestLimits.GetMultiClusterRequestConcurrency())
+	errorChan := make(chan error, len(h.handler.Cluster.RemoteClusters))
 
 	// use channel as a semaphore to limit the number of concurrent
 	// requests at a time
@@ -271,10 +271,10 @@ func (h *collectionFederatedRequestHandler) ServeHTTP(w http.ResponseWriter, req
 	}
 	go func() {
 		wg.Wait()
+		close(errorChan)
 		cancelFunc()
 	}()
 
-	var errors []string
 	errorCode := http.StatusNotFound
 
 	for {
@@ -282,14 +282,16 @@ func (h *collectionFederatedRequestHandler) ServeHTTP(w http.ResponseWriter, req
 		case newResp = <-success:
 			h.handler.proxy.ForwardResponse(w, newResp, nil)
 			return
-		case err := <-errorChan:
-			if httperr, ok := err.(HTTPError); ok {
-				if httperr.Code != http.StatusNotFound {
-					errorCode = http.StatusBadGateway
+		case <-sharedContext.Done():
+			var errors []string
+			for err := range errorChan {
+				if httperr, ok := err.(HTTPError); ok {
+					if httperr.Code != http.StatusNotFound {
+						errorCode = http.StatusBadGateway
+					}
 				}
+				errors = append(errors, err.Error())
 			}
-			errors = append(errors, err.Error())
-		case <-sharedContext.Done():
 			httpserver.Errors(w, errors, errorCode)
 			return
 		}

commit 362aabf839d9864be17b2341fd6730d6edc4f76d
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Wed Nov 7 15:53:08 2018 -0500

    14458: Avoid panic by removing defer close()
    
    Channels will be garbage collected when they go unreferenced.
    
    Make the errors channel buffered to avoid lingering goroutines trying
    to send on an unbuffered error channel with no reciever.
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/lib/controller/fed_collections.go b/lib/controller/fed_collections.go
index b9cd20582..38cf409e6 100644
--- a/lib/controller/fed_collections.go
+++ b/lib/controller/fed_collections.go
@@ -209,15 +209,12 @@ func (h *collectionFederatedRequestHandler) ServeHTTP(w http.ResponseWriter, req
 	wg := sync.WaitGroup{}
 	pdh := m[1]
 	success := make(chan *http.Response)
-	errorChan := make(chan error)
+	errorChan := make(chan error, h.handler.Cluster.RequestLimits.GetMultiClusterRequestConcurrency())
 
 	// use channel as a semaphore to limit the number of concurrent
 	// requests at a time
 	sem := make(chan bool, h.handler.Cluster.RequestLimits.GetMultiClusterRequestConcurrency())
 
-	defer close(errorChan)
-	defer close(success)
-	defer close(sem)
 	defer cancelFunc()
 
 	for remoteID := range h.handler.Cluster.RemoteClusters {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list