Go to file
Thales Macedo Garitezi d435f1211e
fix(live_conn): fix live connection count on race condition
When multiple clients try to connect concurrently using the same
client ID, they all call `emqx_channel:ensure_connected`, increasing
the live connection count, but only one will successfully acquire the
lock for that client ID.  This means that all other clients that
increased the live connection count will not get to call neither
`emqx_channel:ensure_disconnected` nor be monitored for `DOWN`
messages, effectively causing a count leak.

By moving the increment to `emqx_cm:register_channel`, which is only
called inside the lock, we can remove this leakage.

Also, during the handling of `DOWN` messages, we now iterate over all
channel PIDs returned by `eqmx_misc:drain_down`, since it could be
that one or more PIDs are not contained in the `pmon` state.
2021-12-08 10:33:57 -03:00
.ci Merge remote-tracking branch 'origin/main-v4.3' into main-v4.4 2021-11-23 23:18:43 +01:00
.github chore(helm): support cluster discovery by dns 2021-12-07 16:23:19 +08:00
apps Merge pull request #6395 from zhongwencool/sync-from-4.3 2021-12-08 10:57:55 +01:00
bin Sync v4.3 to v4.4 (#6262) 2021-11-23 09:33:20 +08:00
data chore(nodetool): ensure correct lib dirs 2021-05-10 12:04:22 +02:00
deploy chore(helm): support cluster discovery by dns 2021-12-07 16:23:19 +08:00
etc Merge branch 'main-v4.3' into sync-from-4.3 2021-12-07 23:20:01 +08:00
include chore(release): update emqx release version 2021-11-18 15:26:36 +08:00
lib-ce fix(emqx_slow_subs): fix threshold related bugs 2021-12-08 15:05:39 +08:00
lib-extra chore(extra-plugin): statement plugin tag 2021-04-09 09:21:42 +08:00
priv Merge branch 'main-v4.3' into sync-from-4.3 2021-12-07 23:20:01 +08:00
scripts Merge branch 'main-v4.3' into sync-from-4.3 2021-12-07 23:20:01 +08:00
src fix(live_conn): fix live connection count on race condition 2021-12-08 10:33:57 -03:00
test fix(live_conn): fix live connection count on race condition 2021-12-08 10:33:57 -03:00
.editorconfig add editorconfig for emqx 2018-09-03 14:03:20 +08:00
.gitattributes chore(gitattributes): fix file classification. 2021-03-18 21:15:33 +01:00
.gitignore build(relup): update build script for support relup 2021-05-07 21:25:10 +02:00
.tool-versions chore: update toos-versions to pin 23.3.4.9-3 2021-11-16 11:35:13 +01:00
CONTRIBUTING.md docs: format contributing 2021-02-22 15:32:14 +08:00
LICENSE Licensed under the Apache, Version 2.0 2016-02-05 14:26:17 +08:00
Makefile build: define default builder docker image tag (#6245) 2021-11-23 09:34:56 +08:00
NOTICE chore: Add NOTICE file 2021-07-23 10:55:03 +02:00
README-CN.md docs(README): add youtube channel badge 2021-06-01 16:31:10 +08:00
README-JP.md docs(README): add youtube channel badge 2021-06-01 16:31:10 +08:00
README-RU.md docs(README): add youtube channel badge 2021-06-01 16:31:10 +08:00
README.md docs(README): add youtube channel badge 2021-06-01 16:31:10 +08:00
Windows.md feat(windows): Support environment variable override for windows 2021-03-16 11:26:17 +01:00
build build: define default builder docker image tag (#6245) 2021-11-23 09:34:56 +08:00
elvis.config style(elvis): force spaces around | and || 2021-03-22 21:15:16 +01:00
pkg-vsn.sh build: ensure git tag matches release version 2021-11-14 18:23:30 +01:00
rebar.config Merge branch 'main-v4.3' into sync-from-4.3 2021-12-07 23:20:01 +08:00
rebar.config.erl refactor(emqx_slow_subs): refactor use moving average (#6287) 2021-11-26 10:42:15 +08:00

README.md

EMQ X Broker

GitHub Release Build Status Coverage Status Docker Pulls Slack Invite Twitter YouTube

The best IoT MQTT open source team looks forward to your joining

English | 简体中文 | 日本語 | русский

EMQ X broker is a fully open source, highly scalable, highly available distributed MQTT messaging broker for IoT, M2M and Mobile applications that can handle tens of millions of concurrent clients.

Starting from 3.0 release, EMQ X broker fully supports MQTT V5.0 protocol specifications and backward compatible with MQTT V3.1 and V3.1.1, as well as other communication protocols such as MQTT-SN, CoAP, LwM2M, WebSocket and STOMP. The 3.0 release of the EMQ X broker can scaled to 10+ million concurrent MQTT connections on one cluster.

Installation

The EMQ X broker is cross-platform, which supports Linux, Unix, macOS and Windows. It means EMQ X can be deployed on x86_64 architecture servers and ARM devices like Raspberry Pi.

See more details for building and running EMQ X on Windows in Windows.md

Installing via EMQ X Docker Image

docker run -d --name emqx -p 1883:1883 -p 8081:8081 -p 8083:8083 -p 8883:8883 -p 8084:8084 -p 18083:18083 emqx/emqx

Installing via Binary Package

Get the binary package of the corresponding OS from EMQ X Download page.

Build From Source

The EMQ X broker requires Erlang/OTP R21+ to build since 3.0 release.

For 4.3 and later versions.

git clone https://github.com/emqx/emqx.git
cd emqx
make
_build/emqx/rel/emqx/bin console

For earlier versions, release has to be built from another repo.

git clone https://github.com/emqx/emqx-rel.git
cd emqx-rel
make
_build/emqx/rel/emqx/bin/emqx console

Quick Start

If emqx is built from source, cd _build/emqx/rel/emqx. Or change to the installation root directory if emqx is installed from a release package.

# Start emqx
./bin/emqx start

# Check Status
./bin/emqx_ctl status

# Stop emqx
./bin/emqx stop

To view the dashboard after running, use your browser to open: http://localhost:18083

Test

To test everything in one go

make eunit ct

To run subset of the common tests

Examples

make apps/emqx_bridge_mqtt-ct

Dialyzer

To Analyze all the apps
make dialyzer
To Analyse specific apps, (list of comma separated apps)
DIALYZER_ANALYSE_APP=emqx_lwm2m,emqx_auth_jwt,emqx_auth_ldap make dialyzer

Community

FAQ

Visiting EMQ X FAQ to get help of common problems.

Questions

GitHub Discussions is where you can ask questions, and share ideas.

Proposals

For more organised improvement proposals, you can send pull requests to EIP.

Plugin development

To develop your own plugins, see lib-extra/README.md

MQTT Specifications

You can read the mqtt protocol via the following links:

MQTT Version 3.1.1

MQTT Version 5.0

MQTT SN

License

Apache License 2.0, see LICENSE.