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 17570d8cfef93fa87cb7a97414bfdb0f8a5f56d6
Author: Jiahui Li <[email protected]>
AuthorDate: Tue Sep 9 14:51:20 2025 -0500

    Add error handling for `noproc`
    
    Add error handling to avoid the following error:
    
    ```bash
    $ make eunit apps=couch suites=couch_btree_prop_tests
    ...
    **error:{assertMatch,[{module,couch_btree_prop_tests},
                  {line,35},
                  {comment,"Failed property test 'prop_btree_'"},
                  {expression,"proper : quickcheck ( ? MODULE : F ( ) , [ { 
to_file , user } , { start_size , 2 } , { numtests , 3000 } , long_result ] )"},
                  {pattern,"true"},
                  {value,[[{set,{var,1},
                                {call,couch_btree_prop_tests,query_modify,
                                      [[551,502],[{882,c},{948,a}],[]]}}]]}]}
    ```
    
    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