This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 0e92688  Kill fabric attachment receiver when middleman times out
0e92688 is described below

commit 0e926881c2c41a557cac035a779e2a95d13168ca
Author: Nick Vatamaniuc <vatam...@apache.org>
AuthorDate: Tue Apr 3 19:13:35 2018 -0400

    Kill fabric attachment receiver when middleman times out
    
    Attachment receiver process is started with a plain spawn. If middleman 
process
    dies, receiver would hang forever waiting on receive. After a long enough 
time
    quite a few of these receiver processes could accumulate on a server.
    
    Fixes #1264
---
 src/fabric/src/fabric_doc_attachments.erl | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/fabric/src/fabric_doc_attachments.erl 
b/src/fabric/src/fabric_doc_attachments.erl
index 47854d1..7c6ba66 100644
--- a/src/fabric/src/fabric_doc_attachments.erl
+++ b/src/fabric/src/fabric_doc_attachments.erl
@@ -105,13 +105,13 @@ middleman(Req, chunked) ->
 
     % take requests from the DB writers and get data from the receiver
     N = erlang:list_to_integer(config:get("cluster","n")),
-    Timeout = fabric_util:request_timeout(),
+    Timeout = fabric_util:attachments_timeout(),
     middleman_loop(Receiver, N, [], [], Timeout);
 
 middleman(Req, Length) ->
     Receiver = spawn(fun() -> receive_unchunked_attachment(Req, Length) end),
     N = erlang:list_to_integer(config:get("cluster","n")),
-    Timeout = fabric_util:request_timeout(),
+    Timeout = fabric_util:attachments_timeout(),
     middleman_loop(Receiver, N, [], [], Timeout).
 
 middleman_loop(Receiver, N, Counters0, ChunkList0, Timeout) ->
@@ -153,5 +153,6 @@ middleman_loop(Receiver, N, Counters0, ChunkList0, Timeout) 
->
 
         middleman_loop(Receiver, N, Counters3, ChunkList3, Timeout)
     after Timeout ->
+        exit(Receiver, kill),
         ok
     end.

-- 
To stop receiving notification emails like this one, please contact
j...@apache.org.

Reply via email to