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

jiahuili430 pushed a commit to branch add-error-handling-for-noproc
in repository https://gitbox.apache.org/repos/asf/couchdb-ioq.git

commit 6dd192597b38532e2224b8c8a25c826e815ced75
Author: Jiahui Li <[email protected]>
AuthorDate: Tue Sep 9 14:51:20 2025 -0500

    Add error handling for `noproc`
    
    Related PR:
    - https://github.com/apache/couchdb/pull/5635
    - https://github.com/apache/couchdb/pull/5636
---
 src/ioq_server.erl  | 7 ++++++-
 src/ioq_server2.erl | 7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/ioq_server.erl b/src/ioq_server.erl
index 80d9612..c817c65 100644
--- a/src/ioq_server.erl
+++ b/src/ioq_server.erl
@@ -78,7 +78,12 @@ call(Fd, Msg, Priority) ->
                 class = Class,
                 t0 = erlang:monotonic_time()
             },
-            gen_server:call(?MODULE, Request, infinity)
+            try
+                gen_server:call(?MODULE, Request, infinity)
+            catch
+                exit:{noproc, _} ->
+                    gen_server:call(Fd, Msg, infinity)
+            end
     end.
 
 bypass(_Msg, Priority) ->
diff --git a/src/ioq_server2.erl b/src/ioq_server2.erl
index 39aa8f4..c2fc215 100644
--- a/src/ioq_server2.erl
+++ b/src/ioq_server2.erl
@@ -118,7 +118,12 @@ call_int(Fd, Msg, Dimensions, IOType) ->
             },
             Req = add_request_dimensions(Req0, Dimensions),
             Server = ioq_server(Req, IOType),
-            gen_server:call(Server, Req, infinity)
+            try
+                gen_server:call(Server, Req, infinity)
+            catch
+                exit:{noproc, _} ->
+                    gen_server:call(Fd, Msg, infinity)
+            end
     end.
 
 ioq_server(#ioq_request{}, search) ->

Reply via email to