From 5a3169b83a07d62a80f57794dc01b166993e451c Mon Sep 17 00:00:00 2001 From: zhanghongtong Date: Tue, 23 Nov 2021 17:36:27 +0800 Subject: [PATCH 1/4] ci: add new steps for push ecr image when release --- .github/workflows/build_packages.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build_packages.yaml b/.github/workflows/build_packages.yaml index befa37912..1a1b1fb49 100644 --- a/.github/workflows/build_packages.yaml +++ b/.github/workflows/build_packages.yaml @@ -461,6 +461,13 @@ jobs: echo ${{ secrets.DOCKER_HUB_TOKEN }} |sudo docker login -u ${{ secrets.DOCKER_HUB_USER }} --password-stdin sudo TARGET=emqx/${{ matrix.profile }} make docker-push sudo TARGET=emqx/${{ matrix.profile }} make docker-manifest-list + - name: push docker image to aws ecr + if: github.event_name == 'release' + run: | + set -e -x -u + aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws + docker tag emqx/emqx:${version#v} public.ecr.aws/emqx/emqx:${version#v} + docker push public.ecr.aws/emqx/emqx:${version#v} - name: update repo.emqx.io if: github.event_name == 'release' && endsWith(github.repository, 'enterprise') && matrix.profile == 'emqx-ee' run: | From 2348e612faf1b44e0d706cbc8a4992fedf49d8ab Mon Sep 17 00:00:00 2001 From: Tobias Lindahl Date: Tue, 7 Dec 2021 16:05:49 +0100 Subject: [PATCH 2/4] fix(emqx_channel): fix race condition in session takeover Sessions must not enqueue messages when another process is taking over the client id, since it already passed on the message queue in the session state. Without this fix, messages arriving after `{takeover, 'begin'} to a channel with no connection (i.e., a persistent session) would be lost. --- src/emqx_channel.erl | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/emqx_channel.erl b/src/emqx_channel.erl index 7bfef472d..f33b3b337 100644 --- a/src/emqx_channel.erl +++ b/src/emqx_channel.erl @@ -720,20 +720,25 @@ maybe_update_expiry_interval(_Properties, Channel) -> Channel. -spec(handle_deliver(list(emqx_types:deliver()), channel()) -> {ok, channel()} | {ok, replies(), channel()}). +handle_deliver(Delivers, Channel = #channel{takeover = true, + pendings = Pendings, + session = Session, + clientinfo = #{clientid := ClientId}}) -> + %% NOTE: Order is important here. While the takeover is in + %% progress, the session cannot enqueue messages, since it already + %% passed on the queue to the new connection in the session state. + NPendings = lists:append(Pendings, ignore_local(maybe_nack(Delivers), ClientId, Session)), + {ok, Channel#channel{pendings = NPendings}}; + handle_deliver(Delivers, Channel = #channel{conn_state = disconnected, + takeover = false, session = Session, clientinfo = #{clientid := ClientId}}) -> NSession = emqx_session:enqueue(ignore_local(maybe_nack(Delivers), ClientId, Session), Session), {ok, Channel#channel{session = NSession}}; -handle_deliver(Delivers, Channel = #channel{takeover = true, - pendings = Pendings, - session = Session, - clientinfo = #{clientid := ClientId}}) -> - NPendings = lists:append(Pendings, ignore_local(maybe_nack(Delivers), ClientId, Session)), - {ok, Channel#channel{pendings = NPendings}}; - handle_deliver(Delivers, Channel = #channel{session = Session, + takeover = false, clientinfo = #{clientid := ClientId}}) -> case emqx_session:deliver(ignore_local(Delivers, ClientId, Session), Session) of {ok, Publishes, NSession} -> From 83981e7c878fd6228c0a7456c11f280c01569e74 Mon Sep 17 00:00:00 2001 From: zhouzb Date: Wed, 8 Dec 2021 11:27:58 +0800 Subject: [PATCH 3/4] fix(webhook): fix the issue that the path field does not support rule engine variables --- apps/emqx_web_hook/src/emqx_web_hook_actions.erl | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/apps/emqx_web_hook/src/emqx_web_hook_actions.erl b/apps/emqx_web_hook/src/emqx_web_hook_actions.erl index 68e3e85d4..dd203a19e 100644 --- a/apps/emqx_web_hook/src/emqx_web_hook_actions.erl +++ b/apps/emqx_web_hook/src/emqx_web_hook_actions.erl @@ -311,15 +311,12 @@ ensure_content_type_header(Headers, _Method) -> merge_path(CommonPath, <<>>) -> l2b(CommonPath); -merge_path(CommonPath, Path0) -> - case emqx_http_lib:uri_parse(Path0) of - {ok, #{path := Path1, 'query' := Query0}} -> - Path2 = l2b(filename:join(CommonPath, Path1)), - Query = l2b(Query0), - <>; - {ok, #{path := Path1}} -> - l2b(filename:join(CommonPath, Path1)) - end. +merge_path(CommonPath, Path) -> + Path1 = case Path of + <<"/", Path0/binary>> -> Path0; + _ -> Path + end, + l2b(filename:join(CommonPath, Path1)). method(GET) when GET == <<"GET">>; GET == <<"get">> -> get; method(POST) when POST == <<"POST">>; POST == <<"post">> -> post; From 63a6ac2f5fc8d9428816e17d82b80d09f21a5a10 Mon Sep 17 00:00:00 2001 From: zhouzb Date: Thu, 9 Dec 2021 15:26:41 +0800 Subject: [PATCH 4/4] perf(http): bump ehttpc version --- rebar.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar.config b/rebar.config index bb9a48807..bd21d8422 100644 --- a/rebar.config +++ b/rebar.config @@ -37,7 +37,7 @@ {deps, [ {gpb, "4.11.2"} %% gpb only used to build, but not for release, pin it here to avoid fetching a wrong version due to rebar plugins scattered in all the deps - , {ehttpc, {git, "https://github.com/emqx/ehttpc", {tag, "0.1.12"}}} + , {ehttpc, {git, "https://github.com/emqx/ehttpc", {tag, "0.1.13"}}} , {eredis_cluster, {git, "https://github.com/emqx/eredis_cluster", {tag, "0.6.5"}}} , {gproc, {git, "https://github.com/uwiger/gproc", {tag, "0.8.0"}}} , {jiffy, {git, "https://github.com/emqx/jiffy", {tag, "1.0.5"}}}