Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

init:restart() is evil, /_restart is evil, kill -TERM is awesome

  • Loading branch information...
commit 410f4c980e6f3dbb02f0432280523e19210bb83e 1 parent e14a2e5
@janl janl authored
View
2  src/couchdb/couch_httpd_misc_handlers.erl
@@ -98,7 +98,7 @@ handle_restart_req(#httpd{method='POST'}=Req) ->
couch_httpd:validate_ctype(Req, "application/json"),
ok = couch_httpd:verify_is_server_admin(Req),
Result = send_json(Req, 202, {[{ok, true}]}),
- couch_server_sup:restart_core_server(),
+ os:cmd("kill -TERM " ++ os:getpid()), % yolo

Love this commit chunk in particular!

@nickva
nickva added a note

Technically it doesn't match the branch name --
replace-init-restart-with-kill-dash-nine-booyah

To match it should have been "kill -KILL" although not sure which one you'd actually want in this case. A program can trap a TERM signal.

@janl
janl added a note

I used -9 originally, when the branch was created, SIGTERM is a little better here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Result;
handle_restart_req(Req) ->
send_method_not_allowed(Req, "POST").
View
5 src/couchdb/couch_server_sup.erl
@@ -15,7 +15,7 @@
-export([start_link/1,stop/0, couch_config_start_link_wrapper/2,
- restart_core_server/0, config_change/2]).
+ config_change/2]).
-include("couch_db.hrl").
@@ -30,9 +30,6 @@ start_link(IniFiles) ->
{error, already_started}
end.
-restart_core_server() ->
- init:restart().
-
couch_config_start_link_wrapper(IniFiles, FirstConfigPid) ->
case is_process_alive(FirstConfigPid) of
true ->
Please sign in to comment.
Something went wrong with that request. Please try again.