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

vatamane pushed a commit to branch add-error-timeout-exception-to-accpet
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit db1d323060d379d3469004afd98c72ed43a717cc
Author: Nick Vatamaniuc <[email protected]>
AuthorDate: Tue Jun 2 16:57:35 2020 -0400

    Handle error:{timeout, _} exception in couch_jobs:accept
    
    Under load accept loop can blow up with timeout error from
    
`erlfdb:wait(...)`(https://github.com/apache/couchdb-erlfdb/blob/master/src/erlfdb.erl#L255)
    so guard against it just like we do for fdb transaction timeout (1031) 
errors.
---
 src/couch_jobs/src/couch_jobs.erl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/couch_jobs/src/couch_jobs.erl 
b/src/couch_jobs/src/couch_jobs.erl
index adc1b46..5f79407 100644
--- a/src/couch_jobs/src/couch_jobs.erl
+++ b/src/couch_jobs/src/couch_jobs.erl
@@ -300,6 +300,8 @@ accept_loop(Type, NoSched, MaxSchedTime, Timeout) ->
     AcceptResult = try
         couch_jobs_fdb:tx(couch_jobs_fdb:get_jtx(), TxFun)
     catch
+        error:{timeout, _} ->
+            retry;
         error:{erlfdb_error, Err} when Err =:= 1020 orelse Err =:= 1031 ->
             retry
     end,

Reply via email to