You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2024/04/26 23:34:23 UTC
(couchdb) branch fix-invalid-exit-call created (now 40e6271de)
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a change to branch fix-invalid-exit-call
in repository https://gitbox.apache.org/repos/asf/couchdb.git
at 40e6271de Fix invalid call to exit/2 in couch_server
This branch includes the following new commits:
new 40e6271de Fix invalid call to exit/2 in couch_server
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(couchdb) 01/01: Fix invalid call to exit/2 in couch_server
Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch fix-invalid-exit-call
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 40e6271de4cd284c22bb2474b6e6087d1855b8af
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Fri Apr 26 19:11:55 2024 -0400
Fix invalid call to exit/2 in couch_server
Previously we called it as `exit(couch_server_N, config_change)` but exit/2
doesn't know what to do with an atom, it needs a pid.
```
exit(couch_server_1, foo).
** exception error: bad argument
in function exit/2
called as exit(couch_server_1,foo)
*** argument 1: not a pid
```
This doesn't actually restart the servers as indended and it's also making
quite a mess in the eunit logs.
In addition to ensuring we're calling a Pid, use a {shutdown, _} error shapw to
avoid triggering verbose SASL report as it's an expected condition.
---
src/couch/src/couch_server.erl | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/couch/src/couch_server.erl b/src/couch/src/couch_server.erl
index 384f9d308..623b5de2e 100644
--- a/src/couch/src/couch_server.erl
+++ b/src/couch/src/couch_server.erl
@@ -335,7 +335,10 @@ terminate(Reason, Srv) ->
ok.
handle_config_change("couchdb", "database_dir", _, _, N) ->
- exit(couch_server(N), config_change),
+ case whereis(couch_server(N)) of
+ Pid when is_pid(Pid) -> exit(Pid, {shutdown, config_change});
+ undefined -> ok
+ end,
remove_handler;
handle_config_change("couchdb", "update_lru_on_read", "true", _, N) ->
gen_server:call(couch_server(N), {set_update_lru_on_read, true}),
@@ -719,8 +722,8 @@ handle_cast({close_db_if_idle, DbName}, Server) ->
handle_cast(Msg, Server) ->
{stop, {unknown_cast_message, Msg}, Server}.
-handle_info({'EXIT', _Pid, config_change}, Server) ->
- {stop, config_change, Server};
+handle_info({'EXIT', _Pid, {shutdown, config_change}}, Server) ->
+ {stop, {shutdown, config_change}, Server};
handle_info({'EXIT', Pid, Reason}, Server) ->
case ets:lookup(couch_dbs_pid_to_name(Server), Pid) of
[{Pid, DbName}] ->