This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git
The following commit(s) were added to refs/heads/main by this push:
new 378f6048b Add a version check to clouseau connected() function
378f6048b is described below
commit 378f6048be1fdb9ed4c0e05b9c8fcf6dfa93f51a
Author: Nick Vatamaniuc <[email protected]>
AuthorDate: Tue Jan 28 12:11:40 2025 -0500
Add a version check to clouseau connected() function
A ping is not enough. A clouseau instance is not usable if we it's just
connected, it's main process should be up and running as well.
We have observed that it is possible for the clouseau node to be connected
and
respond to pings, but the main process was down. We want to alert or catch
cases when that happens so we ask the main process for the version.
---
src/dreyfus/src/clouseau_rpc.erl | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/dreyfus/src/clouseau_rpc.erl b/src/dreyfus/src/clouseau_rpc.erl
index 9cc1ee0d2..12520da9a 100644
--- a/src/dreyfus/src/clouseau_rpc.erl
+++ b/src/dreyfus/src/clouseau_rpc.erl
@@ -294,7 +294,21 @@ connected() ->
true;
false ->
% We might have just booted up, so let's ping
- pong == net_adm:ping(clouseau())
+ case net_adm:ping(clouseau()) of
+ pong ->
+ % We can ping, but is the main process up?
+ %
+ % In versions 2.x (at least) this was a possibility
+ % > clouseau_rpc:version().
+ % {'EXIT',noconnection}
+ %
+ case (catch version()) of
+ {ok, _} -> true;
+ _ -> false
+ end;
+ _ ->
+ false
+ end
end.
rpc(Ref, Msg) ->