From 4603ea17ef91c939649eb3050d9b8ee32cc2f917 Mon Sep 17 00:00:00 2001 From: GilbertWong Date: Thu, 18 Jul 2019 14:05:52 +0800 Subject: [PATCH 01/13] Better gen_rpc performance --- src/emqx_rpc.erl | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/emqx_rpc.erl b/src/emqx_rpc.erl index 4d01b6229..96adf6605 100644 --- a/src/emqx_rpc.erl +++ b/src/emqx_rpc.erl @@ -23,18 +23,28 @@ -define(RPC, gen_rpc). call(Node, Mod, Fun, Args) -> - filter_result(?RPC:call(Node, Mod, Fun, Args)). + filter_result(?RPC:call(rpc_node(Node), Mod, Fun, Args)). multicall(Nodes, Mod, Fun, Args) -> - filter_result(?RPC:multicall(Nodes, Mod, Fun, Args)). + filter_result(?RPC:multicall(rpc_nodes(Nodes), Mod, Fun, Args)). cast(Node, Mod, Fun, Args) -> - filter_result(?RPC:cast(Node, Mod, Fun, Args)). + filter_result(?RPC:cast(rpc_node(Node), Mod, Fun, Args)). +rpc_node(Node) -> + {Node, erlang:system_info(scheduler_id)}. + +rpc_nodes(Nodes) -> + rpc_nodes(Nodes, []). + +rpc_nodes([], Acc) -> + Acc; +rpc_nodes([Node | Nodes], Acc) -> + rpc_nodes(Nodes, [rpc_node(Node) | Acc]). + + +filter_result({Error, Reason}) + when Error =:= badrpc; Error =:= badtcp -> + {badrpc, Reason}; filter_result(Delivery) -> - case Delivery of - {badrpc, Reason} -> {badrpc, Reason}; - {badtcp, Reason} -> {badrpc, Reason}; - _ -> Delivery - end. - + Delivery. From 86333802b9cb52e72824453bcd9aa5953652d2d9 Mon Sep 17 00:00:00 2001 From: terry-xiaoyu <506895667@qq.com> Date: Thu, 18 Jul 2019 18:40:49 +0800 Subject: [PATCH 02/13] Add configuration for sys_heartbeat --- etc/emqx.conf | 8 ++++++++ priv/emqx.schema | 5 +++++ src/emqx_sys.erl | 8 +++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/etc/emqx.conf b/etc/emqx.conf index 9ce950aae..050f5e4f7 100644 --- a/etc/emqx.conf +++ b/etc/emqx.conf @@ -1878,6 +1878,14 @@ plugins.expand_plugins_dir = {{ platform_plugins_dir }}/ ## Default: 1m, 1 minute broker.sys_interval = 1m +## System heartbeat interval of publishing following heart beat message: +## - "$SYS/brokers//uptime" +## - "$SYS/brokers//datetime" +## +## Value: Duration +## Default: 30s +broker.sys_heartbeat = 30s + ## Enable global session registry. ## ## Value: on | off diff --git a/priv/emqx.schema b/priv/emqx.schema index 1366665ca..fe7607413 100644 --- a/priv/emqx.schema +++ b/priv/emqx.schema @@ -1807,6 +1807,11 @@ end}. {default, "1m"} ]}. +{mapping, "broker.sys_heartbeat", "emqx.broker_sys_heartbeat", [ + {datatype, {duration, ms}}, + {default, "30s"} +]}. + {mapping, "broker.enable_session_registry", "emqx.enable_session_registry", [ {default, on}, {datatype, flag} diff --git a/src/emqx_sys.erl b/src/emqx_sys.erl index 37e22856f..51d0d8cb9 100644 --- a/src/emqx_sys.erl +++ b/src/emqx_sys.erl @@ -28,6 +28,7 @@ , datetime/0 , sysdescr/0 , sys_interval/0 + , sys_heatbeat_interval/0 ]). -export([info/0]). @@ -92,6 +93,11 @@ datetime() -> sys_interval() -> application:get_env(?APP, broker_sys_interval, 60000). +%% @doc Get sys heatbeat interval +-spec(sys_heatbeat_interval() -> pos_integer()). +sys_heatbeat_interval() -> + application:get_env(?APP, sys_heartbeat, 30000). + %% @doc Get sys info -spec(info() -> list(tuple())). info() -> @@ -111,7 +117,7 @@ init([]) -> {ok, heartbeat(tick(State))}. heartbeat(State) -> - State#state{heartbeat = start_timer(timer:seconds(1), heartbeat)}. + State#state{heartbeat = start_timer(sys_heatbeat_interval(), heartbeat)}. tick(State) -> State#state{ticker = start_timer(sys_interval(), tick)}. From 953d32066786d868cffca88ad43f9fa2cbae26c2 Mon Sep 17 00:00:00 2001 From: GilbertWong Date: Thu, 18 Jul 2019 17:40:25 +0800 Subject: [PATCH 03/13] Implement better websocket exit mechanism --- src/emqx_session.erl | 7 +++++++ src/emqx_ws_channel.erl | 21 ++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/emqx_session.erl b/src/emqx_session.erl index 392ce77f5..c5ea950ce 100644 --- a/src/emqx_session.erl +++ b/src/emqx_session.erl @@ -331,6 +331,10 @@ update_expiry_interval(SPid, Interval) -> close(SPid) -> gen_server:call(SPid, close). +-spec(close(spid(), atom()) -> ok). +close(SPid, Reason) -> + gen_server:call(SPid, {close, Reason}). + %%------------------------------------------------------------------------------ %% gen_server callbacks %%------------------------------------------------------------------------------ @@ -457,6 +461,9 @@ handle_call({pubrel, PacketId, _ReasonCode}, _From, State = #state{awaiting_rel handle_call(close, _From, State) -> {stop, normal, ok, State}; +handle_call({close, Reason}, _From, State) -> + {stop, Reason, ok, State}; + handle_call(Req, _From, State) -> ?LOG(error, "Unexpected call: ~p", [Req]), {reply, ignored, State}. diff --git a/src/emqx_ws_channel.erl b/src/emqx_ws_channel.erl index 9571baab8..6d60b968f 100644 --- a/src/emqx_ws_channel.erl +++ b/src/emqx_ws_channel.erl @@ -303,20 +303,23 @@ websocket_info(Info, State) -> ?LOG(error, "Unexpected info: ~p", [Info]), {ok, State}. -terminate(SockError, _Req, #state{keepalive = Keepalive, - proto_state = ProtoState, - shutdown = Shutdown}) -> - ?LOG(debug, "Terminated for ~p, sockerror: ~p", - [Shutdown, SockError]), +terminate(WsReason, _Req, #state{keepalive = Keepalive, + proto_state = ProtoState, + shutdown = Shutdown}) -> + ?LOG(debug, "Terminated for ~p, websocket reason: ~p", + [Shutdown, WsReason]), emqx_keepalive:cancel(Keepalive), case {ProtoState, Shutdown} of {undefined, _} -> ok; {_, {shutdown, Reason}} -> + SessionPid = emqx_protocol:session(ProtoState), emqx_protocol:terminate(Reason, ProtoState), - exit(Reason); - {_, Error} -> - emqx_protocol:terminate(Error, ProtoState), - exit({error, SockError}) + SessionPid ! {'EXIT', self(), Reason}; + {_, _Error} -> + ?LOG(info, "Terminate for unexpected error: ~p", [WsReason]), + SessionPid = emqx_protocol:session(ProtoState), + emqx_protocol:terminate(unknown, ProtoState), + SessionPid ! {'EXIT', self(), unknown} end. %%-------------------------------------------------------------------- From 0c14484b0a3237cb06f8ec676462b797fdac3b9c Mon Sep 17 00:00:00 2001 From: GilbertWong Date: Thu, 18 Jul 2019 19:51:06 +0800 Subject: [PATCH 04/13] Disable the useless error log info --- src/emqx_session.erl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/emqx_session.erl b/src/emqx_session.erl index c5ea950ce..026c10336 100644 --- a/src/emqx_session.erl +++ b/src/emqx_session.erl @@ -461,9 +461,6 @@ handle_call({pubrel, PacketId, _ReasonCode}, _From, State = #state{awaiting_rel handle_call(close, _From, State) -> {stop, normal, ok, State}; -handle_call({close, Reason}, _From, State) -> - {stop, Reason, ok, State}; - handle_call(Req, _From, State) -> ?LOG(error, "Unexpected call: ~p", [Req]), {reply, ignored, State}. @@ -633,7 +630,7 @@ handle_info({'EXIT', ConnPid, Reason}, State = #state{will_msg = WillMsg, expiry _ -> send_willmsg(WillMsg) end, - {stop, Reason, State#state{will_msg = undefined, conn_pid = undefined}}; + shutdown(Reason, State#state{will_msg = undefined, conn_pid = undefined}); handle_info({'EXIT', ConnPid, Reason}, State = #state{conn_pid = ConnPid}) -> State1 = case Reason of From 391e39c3b679298985f65002f466de086636112d Mon Sep 17 00:00:00 2001 From: GilbertWong Date: Thu, 18 Jul 2019 19:54:10 +0800 Subject: [PATCH 05/13] Disable the useless error log info --- src/emqx_session.erl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/emqx_session.erl b/src/emqx_session.erl index 026c10336..20028c9ef 100644 --- a/src/emqx_session.erl +++ b/src/emqx_session.erl @@ -331,10 +331,6 @@ update_expiry_interval(SPid, Interval) -> close(SPid) -> gen_server:call(SPid, close). --spec(close(spid(), atom()) -> ok). -close(SPid, Reason) -> - gen_server:call(SPid, {close, Reason}). - %%------------------------------------------------------------------------------ %% gen_server callbacks %%------------------------------------------------------------------------------ From eb68ce77b661f37c10ae82e6dafa1902c131ba0d Mon Sep 17 00:00:00 2001 From: GilbertWong Date: Thu, 18 Jul 2019 20:11:36 +0800 Subject: [PATCH 06/13] Fix the ws channel terminating crash when session pid is undefined --- src/emqx_ws_channel.erl | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/emqx_ws_channel.erl b/src/emqx_ws_channel.erl index 6d60b968f..096e3261f 100644 --- a/src/emqx_ws_channel.erl +++ b/src/emqx_ws_channel.erl @@ -312,20 +312,25 @@ terminate(WsReason, _Req, #state{keepalive = Keepalive, case {ProtoState, Shutdown} of {undefined, _} -> ok; {_, {shutdown, Reason}} -> - SessionPid = emqx_protocol:session(ProtoState), - emqx_protocol:terminate(Reason, ProtoState), - SessionPid ! {'EXIT', self(), Reason}; + terminate_session(Reason, ProtoState); {_, _Error} -> ?LOG(info, "Terminate for unexpected error: ~p", [WsReason]), - SessionPid = emqx_protocol:session(ProtoState), - emqx_protocol:terminate(unknown, ProtoState), - SessionPid ! {'EXIT', self(), unknown} + terminate_session(unknown, ProtoState) end. %%-------------------------------------------------------------------- %% Internal functions %%-------------------------------------------------------------------- +terminate_session(Reason, ProtoState) -> + emqx_protocol:terminate(Reason, ProtoState), + case emqx_protocol:session(ProtoState) of + undefined -> + ok; + SessionPid -> + SessionPid ! {'EXIT', self(), Reason} + end. + handle_incoming(Packet, SuccFun, State = #state{proto_state = ProtoState}) -> case emqx_protocol:received(Packet, ProtoState) of {ok, NProtoState} -> From caf6dab80828f50250fec2a8683810768c2ef822 Mon Sep 17 00:00:00 2001 From: turtled Date: Thu, 18 Jul 2019 16:16:35 +0800 Subject: [PATCH 07/13] Support K8S hostname auto discovery cluster --- etc/emqx.conf | 7 ++++++- priv/emqx.schema | 10 ++++++++-- rebar.config | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/etc/emqx.conf b/etc/emqx.conf index 050f5e4f7..da3ba53f5 100644 --- a/etc/emqx.conf +++ b/etc/emqx.conf @@ -145,7 +145,7 @@ cluster.autoclean = 5m ## The address type is used to extract host from k8s service. ## -## Value: ip | dns +## Value: ip | dns | hostname ## cluster.k8s.address_type = ip ## The app name helps build 'node.name'. @@ -153,6 +153,11 @@ cluster.autoclean = 5m ## Value: String ## cluster.k8s.app_name = emqx +## The suffix added to hostname get from k8s service, only valid if cluster.k8s.address_type set to hostname +## +## Value: String +## cluster.k8s.hostname_suffix = + ## Kubernates Namespace ## ## Value: String diff --git a/priv/emqx.schema b/priv/emqx.schema index fe7607413..6c54ac945 100644 --- a/priv/emqx.schema +++ b/priv/emqx.schema @@ -129,7 +129,7 @@ ]}. {mapping, "cluster.k8s.address_type", "ekka.cluster_discovery", [ - {datatype, {enum, [ip, dns]}} + {datatype, {enum, [ip, dns, hostname]}} ]}. {mapping, "cluster.k8s.app_name", "ekka.cluster_discovery", [ @@ -140,6 +140,11 @@ {datatype, string} ]}. +{mapping, "cluster.k8s.hostname_suffix", "ekka.cluster_discovery", [ + {datatype, string}, + {default, ""} + ]}. + {translation, "ekka.cluster_discovery", fun(Conf) -> Strategy = cuttlefish:conf_get("cluster.discovery", Conf), Filter = fun(Opts) -> [{K, V} || {K, V} <- Opts, V =/= undefined] end, @@ -176,7 +181,8 @@ {service_name, cuttlefish:conf_get("cluster.k8s.service_name", Conf)}, {address_type, cuttlefish:conf_get("cluster.k8s.address_type", Conf, ip)}, {app_name, cuttlefish:conf_get("cluster.k8s.app_name", Conf)}, - {namespace, cuttlefish:conf_get("cluster.k8s.namespace", Conf)}]; + {namespace, cuttlefish:conf_get("cluster.k8s.namespace", Conf)}, + {hostname_suffix, cuttlefish:conf_get("cluster.k8s.hostname_suffix", Conf, "")}]; (manual) -> [ ] end, diff --git a/rebar.config b/rebar.config index 89b9436af..9ae96648c 100644 --- a/rebar.config +++ b/rebar.config @@ -4,7 +4,7 @@ {gproc, "0.8.0"}, % hex {replayq, "0.1.1"}, %hex {esockd, "5.5.0"}, %hex - {ekka, {git, "https://github.com/emqx/ekka", {tag, "v0.5.7"}}}, + {ekka, {git, "https://github.com/emqx/ekka", {branch, "master"}}}, {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.3.1"}}}, {cuttlefish, {git, "https://github.com/emqx/cuttlefish", {tag, "v3.0.0"}}} ]}. From 01f8ce1dc73e21308e8e73c6143bc5854fb26658 Mon Sep 17 00:00:00 2001 From: turtled Date: Fri, 19 Jul 2019 10:36:32 +0800 Subject: [PATCH 08/13] Add default k8s.suffix --- etc/emqx.conf | 4 ++-- priv/emqx.schema | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/emqx.conf b/etc/emqx.conf index da3ba53f5..df3be2a9a 100644 --- a/etc/emqx.conf +++ b/etc/emqx.conf @@ -153,10 +153,10 @@ cluster.autoclean = 5m ## Value: String ## cluster.k8s.app_name = emqx -## The suffix added to hostname get from k8s service, only valid if cluster.k8s.address_type set to hostname +## The suffix added to dns and hostname get from k8s service ## ## Value: String -## cluster.k8s.hostname_suffix = +## cluster.k8s.suffix = pod.cluster.local ## Kubernates Namespace ## diff --git a/priv/emqx.schema b/priv/emqx.schema index 6c54ac945..1d308476d 100644 --- a/priv/emqx.schema +++ b/priv/emqx.schema @@ -140,7 +140,7 @@ {datatype, string} ]}. -{mapping, "cluster.k8s.hostname_suffix", "ekka.cluster_discovery", [ +{mapping, "cluster.k8s.suffix", "ekka.cluster_discovery", [ {datatype, string}, {default, ""} ]}. @@ -182,7 +182,7 @@ {address_type, cuttlefish:conf_get("cluster.k8s.address_type", Conf, ip)}, {app_name, cuttlefish:conf_get("cluster.k8s.app_name", Conf)}, {namespace, cuttlefish:conf_get("cluster.k8s.namespace", Conf)}, - {hostname_suffix, cuttlefish:conf_get("cluster.k8s.hostname_suffix", Conf, "")}]; + {suffix, cuttlefish:conf_get("cluster.k8s.suffix", Conf, "")}]; (manual) -> [ ] end, From 49afbdabda861d79583ca465440463d9e8b40363 Mon Sep 17 00:00:00 2001 From: turtled Date: Fri, 19 Jul 2019 14:19:29 +0800 Subject: [PATCH 09/13] Update ekka tag --- rebar.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar.config b/rebar.config index 9ae96648c..db7590567 100644 --- a/rebar.config +++ b/rebar.config @@ -4,7 +4,7 @@ {gproc, "0.8.0"}, % hex {replayq, "0.1.1"}, %hex {esockd, "5.5.0"}, %hex - {ekka, {git, "https://github.com/emqx/ekka", {branch, "master"}}}, + {ekka, {git, "https://github.com/emqx/ekka", {tag, "v0.5.8"}}}, {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.3.1"}}}, {cuttlefish, {git, "https://github.com/emqx/cuttlefish", {tag, "v3.0.0"}}} ]}. From 05b660ff50e8e08f01ab3b324d0d25e7254adf49 Mon Sep 17 00:00:00 2001 From: Gilbert Date: Sat, 20 Jul 2019 13:05:34 +0800 Subject: [PATCH 10/13] Unlink session when exit message has been forwarded to session (#2703) * Unlink session when exit message has been forwarded to session * Readjust possition of emqx_protocol:session --- src/emqx_ws_channel.erl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/emqx_ws_channel.erl b/src/emqx_ws_channel.erl index 096e3261f..74a5e2a71 100644 --- a/src/emqx_ws_channel.erl +++ b/src/emqx_ws_channel.erl @@ -328,6 +328,7 @@ terminate_session(Reason, ProtoState) -> undefined -> ok; SessionPid -> + unlink(SessionPid), SessionPid ! {'EXIT', self(), Reason} end. From 0c54d899dab1dfca7771a768068a497c1d01be45 Mon Sep 17 00:00:00 2001 From: terry-xiaoyu <506895667@qq.com> Date: Sat, 20 Jul 2019 13:19:13 +0800 Subject: [PATCH 11/13] Trap and handle exit in channel and ws_channel --- src/emqx_channel.erl | 9 +++++++++ src/emqx_ws_channel.erl | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/src/emqx_channel.erl b/src/emqx_channel.erl index 65d34d740..0aeedcdfa 100644 --- a/src/emqx_channel.erl +++ b/src/emqx_channel.erl @@ -148,6 +148,7 @@ call(CPid, Req) -> %%-------------------------------------------------------------------- init({Transport, RawSocket, Options}) -> + process_flag(trap_exit, true), {ok, Socket} = Transport:wait(RawSocket), {ok, Peername} = Transport:ensure_ok_or_exit(peername, [Socket]), {ok, Sockname} = Transport:ensure_ok_or_exit(sockname, [Socket]), @@ -365,6 +366,14 @@ handle(info, {shutdown, conflict, {ClientId, NewPid}}, State) -> handle(info, {shutdown, Reason}, State) -> shutdown(Reason, State); +handle(info, Info = {'EXIT', SessionPid, Reason}, State = #state{proto_state = ProtoState}) -> + case emqx_protocol:session(ProtoState) of + undefined -> + ?LOG(error, "Unexpected EXIT: ~p", [Info]), + {keep_state, State}; + SessionPid -> shutdown(Reason, State) + end; + handle(info, Info, State) -> ?LOG(error, "Unexpected info: ~p", [Info]), {keep_state, State}. diff --git a/src/emqx_ws_channel.erl b/src/emqx_ws_channel.erl index 74a5e2a71..c308b687e 100644 --- a/src/emqx_ws_channel.erl +++ b/src/emqx_ws_channel.erl @@ -299,6 +299,14 @@ websocket_info({shutdown, Reason}, State) -> websocket_info({stop, Reason}, State) -> {stop, State#state{shutdown = Reason}}; +websocket_info(Info = {'EXIT', SessionPid, Reason}, State = #state{proto_state = ProtoState}) -> + case emqx_protocol:session(ProtoState) of + undefined -> + ?LOG(error, "Unexpected EXIT: ~p", [Info]), + {ok, State}; + SessionPid -> shutdown(Reason, State) + end; + websocket_info(Info, State) -> ?LOG(error, "Unexpected info: ~p", [Info]), {ok, State}. From 721e7c4804e032be3795d7a524117586bd985397 Mon Sep 17 00:00:00 2001 From: terry-xiaoyu <506895667@qq.com> Date: Sat, 20 Jul 2019 14:14:28 +0800 Subject: [PATCH 12/13] Fix session termiated without ws_channel --- src/emqx_channel.erl | 6 +++++- src/emqx_session.erl | 12 +----------- src/emqx_ws_channel.erl | 7 ++++++- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/emqx_channel.erl b/src/emqx_channel.erl index 0aeedcdfa..5aaa62b30 100644 --- a/src/emqx_channel.erl +++ b/src/emqx_channel.erl @@ -371,7 +371,9 @@ handle(info, Info = {'EXIT', SessionPid, Reason}, State = #state{proto_state = P undefined -> ?LOG(error, "Unexpected EXIT: ~p", [Info]), {keep_state, State}; - SessionPid -> shutdown(Reason, State) + SessionPid -> + ?LOG(error, "Session ~p termiated: ~p", [SessionPid, Reason]), + shutdown(Reason, State) end; handle(info, Info, State) -> @@ -508,6 +510,8 @@ maybe_gc(_, State) -> State. reply(From, Reply, State) -> {keep_state, State, [{reply, From, Reply}]}. +shutdown(Reason = {shutdown, _}, State) -> + stop(Reason, State); shutdown(Reason, State) -> stop({shutdown, Reason}, State). diff --git a/src/emqx_session.erl b/src/emqx_session.erl index 20028c9ef..7d23c9e62 100644 --- a/src/emqx_session.erl +++ b/src/emqx_session.erl @@ -652,23 +652,13 @@ handle_info(Info, State) -> terminate(Reason, #state{will_msg = WillMsg, client_id = ClientId, - username = Username, - conn_pid = ConnPid, - old_conn_pid = OldConnPid}) -> + username = Username}) -> send_willmsg(WillMsg), - [maybe_shutdown(Pid, Reason) || Pid <- [ConnPid, OldConnPid]], ok = emqx_hooks:run('session.terminated', [#{client_id => ClientId, username => Username}, Reason]). code_change(_OldVsn, State, _Extra) -> {ok, State}. -maybe_shutdown(undefined, _Reason) -> - ok; -maybe_shutdown(Pid, normal) -> - Pid ! {shutdown, normal}; -maybe_shutdown(Pid, Reason) -> - exit(Pid, Reason). - %%------------------------------------------------------------------------------ %% Internal functions %%------------------------------------------------------------------------------ diff --git a/src/emqx_ws_channel.erl b/src/emqx_ws_channel.erl index c308b687e..23a4d8d4c 100644 --- a/src/emqx_ws_channel.erl +++ b/src/emqx_ws_channel.erl @@ -304,7 +304,9 @@ websocket_info(Info = {'EXIT', SessionPid, Reason}, State = #state{proto_state = undefined -> ?LOG(error, "Unexpected EXIT: ~p", [Info]), {ok, State}; - SessionPid -> shutdown(Reason, State) + SessionPid -> + ?LOG(error, "Session ~p termiated: ~p", [SessionPid, Reason]), + shutdown(Reason, State) end; websocket_info(Info, State) -> @@ -360,6 +362,9 @@ ensure_stats_timer(State = #state{enable_stats = true, ensure_stats_timer(State) -> State. +shutdown(Reason = {shutdown, _}, State) -> + self() ! {stop, Reason}, + {ok, State}; shutdown(Reason, State) -> %% Fix the issue#2591(https://github.com/emqx/emqx/issues/2591#issuecomment-500278696) self() ! {stop, {shutdown, Reason}}, From a6210f714283e6bb7cd6bf6ea3981a5dc5f58989 Mon Sep 17 00:00:00 2001 From: aruldd Date: Fri, 19 Jul 2019 18:59:48 +0530 Subject: [PATCH 13/13] updated the location of built emqx --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 35ed465e8..a9c6e710f 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ git clone https://github.com/emqx/emqx-rel.git cd emqx-rel && make -cd _rel/emqx && ./bin/emqx console +cd _build/emqx/rel/emqx && ./bin/emqx console ```