Commit Graph

2421 Commits

Author SHA1 Message Date
Turtle 87ee94b6f2 chore(version): update emqx version to 4.3.7 2021-08-04 18:44:47 +08:00
JianBo He d3d019cb89 chore(emqx): update appup.src 2021-07-28 13:54:13 +08:00
JianBo He 07c29e8c55 chore(acl): support ipaddr list 2021-07-28 13:54:13 +08:00
Zaiming Shi dd23ee6b15 fix(emqx_app): stop listeners in application prep_stop callback
Application:stop is call after the root supervisor is stopped,
in our case, prior to this fix, emqx_sup is stopped before
the listeners (hence the emqx_connection processes).

This causes shutdown to emit a lot of error logs
e.g. emqx_broker pool is down, but emqx_connection process is still
trying to call the pool
2021-07-28 08:52:04 +08:00
Turtle 5edb5351b0 chore(relup): update emqx appup 2021-07-16 19:01:05 +08:00
JianBo He 46d0cb69dc chore(emqx): update appup.src 2021-07-13 17:53:34 +08:00
JianBo He 240a4b88a5 fix(cm): add a timeout to rpc_call function
An infinite wait will leave the client process waiting for
a return and cause the client to go to a dead state
2021-07-13 17:53:34 +08:00
Shawn 5fbf83e7f0 fix(shared_sub): discard all unexpected msgs 2021-06-28 09:37:34 +08:00
Shawn 513cd001ac chore(appup): update the appup for 4.3.5 2021-06-25 20:38:43 +08:00
Shawn 868cd6e57c fix(shared_sub): failed to clean the emqx_shared_subscription tab
A trick that fixes the issue that we demonitored the shared subscriber
too early if it not unsubscribed all of the topics.
2021-06-25 20:38:43 +08:00
Turtle 1a438125c7 chore(review): review 4.3.4 2021-06-23 17:51:17 +08:00
JianBo He 3ddbdbc6c1
fix(emqx_cm): catch noproc exception from rpc_call (#5048) 2021-06-23 09:45:24 +08:00
JianBo He bbed1b55e0 fix(ws): avoid funcation_clause for un-inited websocket 2021-06-15 11:27:47 +08:00
JianBo He 42a6f2aba5
fix(mqttsn): fix proto_name to MQTT-SN instead of MQTT (#4961) 2021-06-11 11:08:24 +08:00
Turtle eac04b243f fix(relup): fix relup badfun 2021-06-05 02:02:16 +08:00
Zaiming Shi 8bf3c511d8 test: fix a flacky test case 2021-06-04 16:04:58 +02:00
Zaiming Shi 54458e3924 chore(appup): ensure emqx_app alwasy loaded in appup 2021-06-03 13:02:49 +02:00
Tobias Lindahl 981364341e chore(appup): load emqx_channel in appup
Note that the large whitespace diff on the appup file is because this
is the first time the new script for modifying appup files is used.
2021-06-03 12:22:58 +02:00
Tobias Lindahl 90529e18c6 fix: including subscription id keeps correct return code for qos > 0
When subscription id is set, the return code was set to 0 rather than
the provided qos number due to earlier fix of acl check order.
2021-06-03 10:44:13 +02:00
JianBo He 3a89b1f00b
chore(action): fix syntax error (#4885) 2021-05-31 15:08:52 +08:00
Rory-Z 231c800f40 fix(ws connect): fix ws connect with Proxy Protocol capture wrong client-ip 2021-05-27 08:18:34 +00:00
Zaiming Shi 1e2bd2610f feat(emqx_connection): async_set_keepalive defaults to self() 2021-05-27 16:18:17 +08:00
Turtle c02a9f0101 fix(appup): update appup 2021-05-27 13:55:07 +08:00
Zaiming Shi dabf7c66ad fix: external plugin load all
Load all apps in external plugins directory
this is to allow adding other apps as external plugin's dependency
2021-05-27 13:36:57 +08:00
k32 812faf08a1 chore(logger): Update snabbkaffe to 0.13.0 2021-05-25 21:15:59 +02:00
Zaiming (Stone) Shi 37c559a08d
Merge pull request #4858 from zmstone/fix-frame-parse-split-function-clause
fix(emqx_frame): no need to split incoming bytes
2021-05-25 06:57:17 +02:00
Zaiming Shi 1ec3c2d7b9 fix(emqx_node_dump): call atom_to_binary/2
atom_to_binary/1 is added in otp 23,
we still need to support older version
2021-05-25 12:46:47 +08:00
Zaiming Shi 979e495a1e fix(emqx_frame): no need to split incoming bytes
Prior to this commit, there was a bug in emqx_frame:split/2
the tail number of bytes was used for header number of bytes
whens split. As a result, if the tail happens to be longer
then haeder, the parsing state becomes invalid and it crashes
when the next packet arrives

The split was a over-engineered micro-optimization, so it
has been deleted instead of fixed
2021-05-24 21:07:03 +02:00
Zaiming Shi 6701d716dd feat: async API to support tcp keepalive inet options 2021-05-24 19:01:13 +02:00
Zaiming Shi 623ffc7861 fix: add emqx_plugins to appup 2021-05-24 10:45:56 +02:00
Zaiming Shi 4ec1046160 fix: bad test case 2021-05-24 10:45:56 +02:00
Zaiming Shi faecde9ce1 fix(emqx_plugins): allow loading conf for plugin app dir
Prior to this change, plugin config files are only allowed
to be placed in the collective config dir etc/plugins.
In order to support external plugin's drop-in deployment,
this commit made emqx_plugins module to read conf file
in application's etc dir
2021-05-24 10:45:56 +02:00
Zaiming Shi 67245b06b1 chore: make sure emqx_app is reloaded
we bump release version number in emqx_release.hrl for each release
this version is retrieved from emqx_app module, so we must always
reload this module during hot upgrade
2021-05-22 14:56:11 +08:00
Turtle e8790f6e11 fix(mqtt-sn): Fix stop due to keepAlive at sleep mode 2021-05-21 19:22:32 +08:00
Zaiming Shi 4e1798e3f3 fix(emqx_cm): do not log noproc as error
1. websocket call exit with noproc reason.
2. do not capture stacktrace when no need for it
2021-05-19 23:16:11 +02:00
Zaiming Shi dfab9492c6 fix(emqx_connection): do not log einval error
einval happens when trying to send data to a closed socket.
2021-05-18 20:30:27 +08:00
Shawn 97e27faf05
fix(emqx): check if the congestion alarm was sent before clearing (#4824) 2021-05-18 10:34:23 +08:00
Zaiming Shi 5013fb6920 fix(node_dump): obfuscate more secrets 2021-05-17 09:17:29 +02:00
Zaiming Shi ed0ad3e796 chore: skip printing memory 2021-05-14 10:45:58 +02:00
Zaiming Shi 78fd1a80c5 fix(bench): test more publish levels 2021-05-14 10:45:58 +02:00
Zaiming Shi 55316b3ac3 perf: micro optimisation: no lookup for non-wildcard in trie 2021-05-14 10:45:58 +02:00
Zaiming Shi 3c03047c9f fix(emqx_trie): performance issue when many levels 2021-05-14 10:45:58 +02:00
Zaiming Shi 30990edbd4 fix(emqx_broker_bench): test real match performance 2021-05-14 10:45:17 +02:00
Zaiming Shi d0971ceb53 fix: add emqx appup 2021-05-14 10:42:11 +02:00
Zaiming Shi de43da881a fix(emqx_frame): poor large frame concatenation performance
piror to this change, binary concatenation eats most of the CPU
2021-05-13 22:58:22 +02:00
Zaiming Shi 1e3f7319ac fix(emqx_metrics): infinity gen_server call in upgrade 2021-05-13 22:57:44 +02:00
JianBo He c929306cb9 chore(metrics): update ets table in the metrics proc 2021-05-13 22:57:44 +02:00
JianBo He 1ba8d71e7e fix(metrics): set the retained/delayed metrics to counter type
The metrics for messages.* shows the number of times such messages are
received, and it should be a counter rather than a gauge type.
2021-05-12 22:16:14 +08:00
Zaiming Shi 1cabd140c5 fix(logging): add line-break after each JSON log 2021-05-10 12:03:01 +02:00
Zaiming Shi 18cd7e7af5 fix(emqx_logger_jsonfmt): corner test case 2021-05-07 21:25:10 +02:00
Zaiming Shi 05c5378265 feat(http_lib): add normalise_headers API 2021-05-07 10:14:19 +08:00
Zaiming Shi c81cd8550d perf(trie): do not call ets:info/2 to check if table is empty
emqx_trie table is a ordered_set, with write_concurrency set to
true, the counter is not centrialsed, the ets:info/2 call to
check size == 0 is very expensive
2021-05-06 23:27:29 +08:00
Zaiming Shi cfec4c9690 fix(logger): fix json formatter
crash when invalid string as json key.
2021-05-06 15:12:56 +02:00
k32 1db8483bb3 feat(node_dump): Hide `secret' configuration keys
Co-authored-by: Zaiming (Stone) Shi <zmstone@gmail.com>
2021-05-06 14:19:09 +02:00
k32 e6c85dfb04 fix(node_dump): Attempt to censor passwords 2021-05-06 14:19:09 +02:00
Zaiming Shi 4cff5c4dac chore: fix config doc 2021-05-06 11:03:02 +02:00
Zaiming Shi 6b0487d69d feat(logger): merge metadata to log data 2021-05-06 11:03:02 +02:00
Zaiming Shi 79181072e2 feat(logger): add formatter emqx_logger_jsonfmt 2021-05-06 11:03:02 +02:00
Zaiming Shi 92d3e16d43 perf(router): receive-mark optimise for short-lived transaction process 2021-05-05 11:00:00 +02:00
Zaiming Shi f8700e3f27 fix(emqx_packet): no crash if publish packet has no data 2021-05-04 13:48:35 +02:00
Zaiming Shi bf4baf708a fix(emqx_packet): list element index out of range 2021-05-04 09:24:54 +02:00
Zaiming Shi 171933301a fix(dashboard): display full Erlang/OTP version 2021-04-30 12:26:59 +02:00
William Yang e122ac5716 perf(broker): speedup trans when broker has a big mqueue 2021-04-29 08:52:42 +02:00
William Yang e7fc75fdf2 perf(broker): Optimization for handling bursty traffic
intro. new lock type: 'spawn' of broker.perf.route_lock_type

mnesia get lock calls are not optimized for selective receive.

hence taking locks would be very expensive while there are tones of
messages in the brokers message queue.

This optimization run the transaction in a separate process to utilize
the selective receive optimization of the compiler.
2021-04-28 15:39:46 +02:00
Zaiming Shi 29475eb610 feat(emqx_http_lib): try to parse host ip 2021-04-28 10:43:36 +02:00
Zaiming Shi b688bcfe74 feat(eqmx_misc): add an api to ensure ipv6_probe socket option 2021-04-28 10:43:36 +02:00
Zaiming Shi e54433d342 feat(emqx_vm): add api to inspect which otp version running on 2021-04-28 10:43:36 +02:00
Zaiming Shi d926800204 chore: add emqx_broker_bench.erl 2021-04-26 14:40:39 +02:00
Zaiming Shi cdacaf8694 perf(emqx_trie): use ordered_set 2021-04-26 14:18:40 +02:00
Zaiming Shi b1df759adc refactor(emqx_trie): rename internal function to match_# 2021-04-26 14:18:40 +02:00
Zaiming Shi 8d55d425dc chore(emqx_trie): add test case to cover multiple levels of + wildcards 2021-04-26 14:18:40 +02:00
Zaiming Shi eb946eb80c fix(emqx_trie): do not try to match wildcard topics 2021-04-26 14:18:40 +02:00
Zaiming Shi 22e72cdd82 refactor(emqx_trie): rename record from eqmx_topic to emqx_trie 2021-04-26 14:18:40 +02:00
Zaiming Shi bc6a87946c refactor(emqx_trie): store only prefixes
This commit refactors emqx_trie implementation
with mainly two changes

1. Deleted the edge table.

   In the old implementation, trie consist of nodes and edges.
   e.g. for topic 'a/b/+/d', node 'a' with edge 'b'
   points to node 'a/b' and so on.

   However, edges can be computed at runtime,
   so there is no need to store them in a table.
2021-04-26 14:18:40 +02:00
Zaiming Shi 7128bc9e6e chore(emqx_app): do not print 'starting' log when test 2021-04-26 14:18:40 +02:00
Zaiming Shi 5569c86319 docs(emqx_trie): no doc for internal functions 2021-04-26 14:18:40 +02:00
Zaiming Shi 6be28cecab chore(logging): default to multi-line logging 2021-04-26 11:11:27 +02:00
William Yang 907502fed0
Merge pull request #4645 from qzhuyan/dev/william/fix-issue-2985-c3
fix: issue 2985 attempt 3
2021-04-25 12:39:52 +02:00
Zaiming Shi 708420eb97 fix(emqx_connection): log true stacktrace 2021-04-25 12:01:05 +02:00
Zaiming Shi 2e6ad828a0 chore: remove copyright and license Erlang macros 2021-04-23 20:43:00 +02:00
Zaiming Shi 6354e75626 chore: update copyrights 2021-04-23 20:43:00 +02:00
William Yang 9b13bab2c9 perf: new perf toggle broker.perf.route_lock_type 2021-04-23 13:51:42 +02:00
Zaiming Shi 3547dc4c93 fix(log): client id as string for log metadata
so it does not print <<"...">> to the logs
2021-04-23 06:54:10 +02:00
Zaiming Shi fd69969014 refactor(logging): Log to single line 2021-04-23 06:54:10 +02:00
William Yang 0166bb5a87 fix: broker call should not timeout before client timeout
So change broker call timeout to infinity.
2021-04-21 18:59:46 +02:00
William Yang 17870fdb39 perf(router): add route runs in async dirty context 2021-04-21 18:59:46 +02:00
William Yang 3972a6b435 perf(trie): use global lock
Use global lock to reduce remote lock overhead.

So that emqx route trans can run in dirty *sync* context.

At least 10X subscribe/unsubscribe improvments.
2021-04-21 18:59:24 +02:00
Zaiming Shi 97f2e5d544 test(auth_http): test unset acl_req app env 2021-04-19 08:39:26 +02:00
zhouzb 49502b4e7c feat(uri): add missed function 2021-04-16 20:19:45 +08:00
zhouzb bd1051d1e6 feat(uri): support decoding uri in string 2021-04-16 20:19:45 +08:00
Shawn 4885171e4f fix(emqx): add timeout for open/kick a session 2021-04-15 23:09:58 +08:00
zhanghongtong 446a69c814 fix(ws connection): fix peer_cert_as_username error when ws connect 2021-04-15 09:06:27 +08:00
z8674558 a48e7df4f5 feat(emqx_ws_connection): check http header to know real IP/port 2021-04-14 06:45:39 +00:00
JianBo He 49b7d870e0 fix(modules): load application first for ekka_mnesia scanner 2021-04-13 09:57:33 +08:00
JianBo He 16c999ed9b
Start emqx-modules application by default (#4518)
* fix(modules): start emqx_modules by default

* chore(test): eliminate some compile warnings
2021-04-12 09:45:31 +08:00
Shawn f902d880c1 fix(emqx): rename wont_clear_alarm_in to min_alarm_sustain_duration 2021-04-10 12:17:04 +08:00
Shawn df0e905754 refactor(emqx): the congestion alarm 2021-04-10 12:17:04 +08:00
Shawn 327b0c0995 fix(mqtt_sn): send pingresp until all pubacks received 2021-04-10 09:36:56 +08:00
Yudai Kiyofuji e3a5f65c88
feat(config): print override env (#4517) 2021-04-09 16:28:01 +02:00
Zaiming Shi 7667b65710 fix(emqx): Do not io:format when testing 2021-04-09 10:18:25 +02:00
Zaiming Shi 6f5aa88562 chore(emqx_connection): Add a test case to cover oom kill 2021-03-30 10:08:13 +02:00
Zaiming Shi 6e1a55e9ed perf(emqx_connection): no priority receive
Prior to this change the main message receive loop of emqx_connection
is a priority receive which selects system messages and parent EXIT
signals prior to other message.
This accidental (not intended) design may cause the receive operation
to scan potentially large mail box.
2021-03-30 10:08:13 +02:00
Zaiming Shi 66693d6846 fix(emqx_connection): connection OOM kill immediately
Prior to this change, connection process' OOM kill is a loopback
message, which results in a delayed kill when message queue length
is large.
In this change, the loopback message is changed to an exit signal.
2021-03-30 10:08:13 +02:00
wwhai 2e30d7803f fix(channel): fix `keep-alive` problem 2021-03-30 16:01:42 +08:00
Shawn 7bf6ee0f4b
fix(mqtt-sn): sleep mode not working #4434 (#4435) 2021-03-29 17:51:49 +08:00
Zaiming Shi 6c77fa1bf7 fix(emqx_channel): Receive Maximum spec compliance
According to MQTT 5.0 specification
If the Receive Maximum value is absent then its value defaults to
65,535.
2021-03-29 09:42:07 +02:00
Zaiming Shi b10a60cddb fix(conninfo): Ensure receive_maximum do not exceed limit 2021-03-29 09:42:07 +02:00
JianBo He 496e5381fb chore(rule-engine): compatible with the lower case hash string 2021-03-25 09:10:05 +08:00
Zaiming Shi a4b30ea77c feat(emqx): Add backtrace_depth configuration 2021-03-23 21:30:49 +01:00
Zaiming Shi 4c5273c1d1 style(emqx_inflight): elvis: User UPPER_CASE macro 2021-03-23 21:30:49 +01:00
JianBo He 277cab86d3 refactor: improve the speed of hexstr and binary conversions 2021-03-23 18:25:19 +08:00
Zaiming Shi 8201e4c820 feat(emqx.erl): Add a help function to load debug secret 2021-03-19 21:46:03 +01:00
Zaiming Shi e06b54ff71 chore(boot-log): print a warning at boot when running on old otp 2021-03-19 15:39:11 +01:00
Zaiming Shi 2d150127d4 feat(listeners): Ensure no tlsv1.3 for otp 22 or earlier 2021-03-19 15:39:11 +01:00
zhanghongtong 72c1ee264c chore(elvis): fix elvis error 2021-03-19 16:11:23 +08:00
zhanghongtong 568f4de6e5 fix(channel): fix the wrong acl check order
when subscribe, check the acl rule before run 'client.subscribe' hooks
2021-03-19 16:11:23 +08:00
Shawn 81602c973c fix(emqx): deny pingreq when mqtt not connected #4370 2021-03-19 14:17:49 +08:00
Karol Kaczmarek c7b44caa1d feat(acl): Add possibility to remove all acl cache 2021-03-17 19:48:42 +01:00
William Yang d5886c0c66
chore(build): Get rel vsn fallback (#4339) 2021-03-16 09:49:11 +01:00
z8674558 e9180b9ce8 chore(emqx_messages): fix elvis 2021-03-11 16:01:35 +09:00
z8674558 9087f0c138 feat(emqx_message): add from_map 2021-03-11 16:01:30 +09:00
Shawn b400571dbb fix(emqx): validate mqtt malformed varible byte integer 2021-03-10 10:41:57 +01:00
Zaiming Shi 582dea10f5 style(emqx_sys): make elvis happy 2021-03-09 20:22:48 +01:00
Zaiming Shi e1979bf488 chore(build): Single source of EMQX_DESCRIPTION 2021-03-09 20:22:48 +01:00
Zaiming Shi 00a2daba19 chore(build): add more enterprise build support 2021-03-06 10:56:07 +01:00
Zaiming Shi 1af1dd17b5 chore(build): use 'EMQ X test' as app description for test runs 2021-03-06 08:41:50 +01:00
Zaiming Shi 73500a0983 chore(build): inject product description from makefile 2021-03-06 08:41:50 +01:00
Zaiming Shi c752f3bec5
Refactor http lib add uri parse (#4292)
* feat(http_lib): Add uri parse to emqx_http_lib

* fix(webhook): call emqx_http_lib to parse uri

* fix(auth-http): Call emqx_http_lib to parse uri

* fix(rule-engine): call emqx_http_lib to parse uri
2021-03-06 13:35:02 +08:00
Zaiming Shi 9b3ab169ce chore(versioning): detach package version from emqx app version 2021-03-04 20:24:58 +01:00
Zaiming Shi 42098b497f
Merge pull request #4283 from zmstone/add-emqx-http-lib
refactor(http-lib): Add emqx_http_lib
2021-03-04 07:14:02 +01:00
zhanghongtong 67c8b2eed7 chore: update emqx.app.src version 2021-03-04 08:10:48 +08:00
Zaiming Shi 63c001a7aa refactor(http-lib): Add emqx_http_lib
So far only uri_encode and uri_decode APIs
2021-03-03 21:38:10 +01:00
z8674558 3daefe954b chore(src): fix elvis 2021-03-03 20:06:31 +09:00
z8674558 a8558bc7b5 chore(emqx_channel): ignore peer_cert_as/5 from dialyzer 2021-03-03 20:06:31 +09:00
z8674558 e1b915b91c chore(emqx_tracer): pass proper map 2021-03-03 20:06:31 +09:00
zhanghongtong cae0849152 fix(emqx_channel): fix bug when publish deny
fix the bug of replying to puback when the publish message with Qos equal to 2 is deny
2021-03-02 17:54:22 +08:00
Zaiming Shi dd06d70bce refactor(build): Move parse_transform module to root app
So we do not have to workaround the compile order issue
2021-03-02 08:40:19 +08:00
Zaiming Shi 6e0b53fbb9 fix(eunit): fix emqx_tls_lib_tests 2021-03-01 21:00:17 +08:00
Zaiming Shi 0a51bd4c2f fix(webhook): Call common lib for ssl options 2021-03-01 21:00:17 +08:00
Zaiming Shi 700fa71754 refactor(tls): abstract lib for tls options parsing 2021-03-01 21:00:17 +08:00
z8674558 64ac20eec5 chore(emqx_listeners): fix clauses for dialyzer 2021-03-01 16:56:21 +08:00
z8674558 6ea4501de4 chore(emqx_listeners): fix type 2021-03-01 16:56:21 +08:00
Zaiming Shi 3dfa9f45c4
Merge pull request #4183 from zmstone/merge-e4.2.4-to-dev-4.3.0
Merge e4.2.4 to dev 4.3.0
2021-02-19 10:26:47 +01:00
Zaiming Shi 71d02e8011 chore(emqx_connection): delete stale code 2021-02-19 10:20:16 +01:00
Benjamin Große ca1d24a98d feature(mgmt): restart a listener
example:

```
emqx_ctl listener restart mqtt:ssl:external
```

or

```
PUT /api/v4/listeners/mqtt:ssl:external/restart
```

thank you @zmstone for providing the listener-identifier apis :)
2021-02-19 09:22:47 +01:00
Zaiming Shi 98b319a0c0
Merge pull request #4190 from zmstone/refactor-assing-names-to-listeners
feat(listeners): Add identifier to listeners
2021-02-19 07:50:27 +01:00
Zaiming Shi 64cfaf4385 improve(print): io:format error message without indentation
Avoid squeezing lines to the right.
2021-02-19 07:45:37 +01:00
Benjamin Große 28f9b4d519 feat(peer_cert_as_clientid): peer_cert_as_clientid = cn | dn | crt | pem | md5
pem is base64 encoded instead of binary crt

peer_cert_as_username=crt breaks exhook proto utf8 parsing of username

crt cannot be used in a topic name due to being invalid utf8
pem cannot be used in a topic name due to having slashes

peer_cert_as_clientid = md5 allows to e.g. subscribe to "t/%c" with ACL

existing peer_cert_as_username combinations are unaffected.
2021-02-19 10:53:11 +08:00
Zaiming Shi d2bd9b4078
Merge pull request #4197 from zmstone/improve-shared-sup-random-start-point-for-roundrobin
improve(shared-sub): Randomise the startpoint for round-robin
2021-02-18 13:26:01 +01:00
Zaiming Shi db461179c5 improve(shared-sub): Randomise the startpoint for round-robin 2021-02-17 19:10:37 +01:00
Shawn eec64e440d
fix(tracer): create short handler-id if clientid is too long (#4164)
* fix(tracer): create short handler-id if clientid is too long

No need to support lists and atoms for when tracing clients/topics.
2021-02-16 14:45:33 +08:00
Zaiming Shi a93d62ace6 refactor(cli): Print listener ID as table head 2021-02-15 10:34:47 +01:00
Zaiming Shi f9465dda16 Merge branch 'dev/v4.3.0' into merge-e4.2.4-to-dev-4.3.0 2021-02-14 21:41:23 +01:00
Zaiming Shi c5a02c729a feat(listeners): Add an api to ensure all listeners are started 2021-02-14 21:30:50 +01:00
Zaiming Shi dfa9bbc0c2 refactor(listeners): use emqx_ctl to print cli messages
It's better to keep cli print behaviour consistent.

It also makes tests easier as they can meck emqx_ctl:print to
validate the output.
2021-02-14 20:40:01 +01:00
Zaiming Shi 153977609e feat(listeners): Add identifier to listeners
Listeners are internally identifiered by the listen-on tuple
which is not UI friendly when we have to find a listener by this
'signature'.

The listeners are actually named in configs, but the names are
discarded in the parsing functions.

This commit is to keep the name and provide an API to find
listener by name (identifier).
2021-02-14 18:12:40 +01:00
Zaiming Shi dc184574a3 chore(style): fix elvis check for emqx_access_rule 2021-02-13 11:54:09 +01:00
Zaiming Shi 406a7d60c7 chore(style): fix elvis check for emqx_connection 2021-02-13 11:50:17 +01:00
Zaiming Shi 9b82112b7c Merge remote-tracking branch 'origin/dev/e4.3.0' into merge-e4.2.4-to-dev-4.3.0 2021-02-13 11:10:08 +01:00
Zaiming Shi f000b6583c fix(tls): Ensure tls config integrity
For default tsl version and ciphers, we try to use otp release number
to determin if we want to use tlsv1.3

For default configs, we try to porivde both tlsv1.3 and
ciphers in config (even for commented out configs)
2021-02-09 22:56:28 +01:00
Zaiming Shi 2852ac79d4 feat(tls): Add a tls lib module
emqx_tls_lib is added to help ensure integrity of tls version
and cipher options.
2021-02-09 21:20:26 +01:00
Zaiming Shi 7aff861f9b refactor(emqx_modules): Move emqx_modules to lib-opensource
emqx_moduels for enterprise is refactored as a lib/plugin
in order to avoid merge conflicts, we make sure they can
co-exist in the same branch, because lib-opensource is compiled
in opensource project and lib-enterprise (to be added) is
compiled in enterprise project
2021-02-08 21:35:44 +01:00
emqx-ci-robot 6c1129dc6a
Auto-pull-request-on-2021-01-29 (#4114)
* fix(share sub): fix the issue that the number of subscriptions dropped to 0 during the picking subscriber and caused a crash

* Connection Busy Alarms (#3992)

feat(emqx_connection): improve port_busy alarm

* fix(emqx_connection): tune the congestion alarm params

* chore(deps): upgrade esockd to 5.7.5
* fix(appup): correct the appup file
2021-01-30 10:30:18 +08:00
zhanghongtong d78b2b23c1 chore(build): update pkg version 2021-01-29 19:29:41 +08:00
tigercl 5878950dc3
feat(websocket): support for checking subprotocols (#4099) 2021-01-28 20:42:57 +08:00
JianBo He 02cb8d0211 chore(style): set warnings_as_errors compile option 2021-01-27 18:02:12 +08:00
Zaiming Shi de972b3d84 fix(emqx_vm): Call recon_alloc:allocators/0 to get allocators 2021-01-23 11:42:28 +01:00
Zaiming Shi 23b2f4fa72
Merge pull request #4050 from zmstone/chore-delete-stale-code
chore(emqx_vm): delete stale code
2021-01-23 11:13:22 +01:00
JianBo He 7c3cd26589 chore(elvis): fix elvis wanrings 2021-01-23 18:07:58 +08:00
JianBo He f59377adf5 fix(logs): print the correct username and clientid 2021-01-23 18:07:58 +08:00
Zaiming Shi 33c35915ca refactor(emqx_vm): make elvis happy 2021-01-22 09:23:20 +01:00
Zaiming Shi 4680ba574c chore(emqx_vm): Delete get_ets_object, not used 2021-01-22 09:21:45 +01:00
Zaiming Shi 47df29ae49 chore(emqx_vm): delete stale code
The port binary format is no longer compatible in OTP 23
2021-01-22 07:50:00 +01:00
Zaiming Shi 0087303b25 feat(shared_sub): Support hashing from source topic. 2021-01-21 21:05:56 +01:00
Zaiming Shi 5aa63ed203 fix(shared_sub): align default value and default config
Shared subscription default dispatch strategy is 'random' in config
but 'round_robin' in code. This commit is to make sure they are the
same: both are 'random'.
2021-01-21 21:05:56 +01:00
Zaiming Shi 598207e308 fix(ws_connection): proplists:get_bool for boolean flags 2021-01-15 14:28:22 +01:00
ayodele.akingbule 5794a708ed feat(emqx_ws_connection): Prevent EMQX from CSWSH Cross-Site Web-Socket Hijack 2021-01-15 14:28:22 +01:00
JianBo He 32b23b9181 Revert "feat(auth_http): support for getting websocket cookies"
This reverts commit 5427057c2c.
2021-01-14 15:10:48 +01:00
JianBo He d437f9f228 chore(elvis): fix elvis warnings 2021-01-14 15:46:16 +08:00
JianBo He f2190dd5b5 chore(mnesia): explicitly specify the copy type for table 2021-01-14 15:46:16 +08:00
JianBo He 76fc6225d3 fix(elvis): fix elvis checking 2021-01-14 15:46:16 +08:00
JianBo He 2a029b71c9 perf(mnesia): unify the copy types of all nodes 2021-01-14 15:46:16 +08:00
JianBo He 5427057c2c feat(auth_http): support for getting websocket cookies
see: https://github.com/emqx/emqx-auth-http/pull/225
2021-01-11 09:21:16 +08:00
Ayodele 2b481dabe7
Fix some dialyzer warnings (#3988) 2021-01-05 20:49:50 +01:00
ayodele.akingbule b9bb88d9eb fix(emqx): fix dialyzer warnings 2021-01-04 14:14:55 +01:00
zhouzb fbf8d3e111 fix(share sub): fix the issue that the number of subscriptions dropped to 0 during the picking subscriber and caused a crash 2020-12-31 14:03:55 +08:00
Shawn 4f82c77e7a
fix(log): improve the error log message on hook failure (#3973) 2020-12-31 13:55:09 +08:00
zhouzb ac0f51fec3 fix(max topic len): use the maximum length limit by default 2020-12-28 14:48:32 +08:00
JianBo He 739e49218f
fix(cm): fix the problem of registering a channel twice (#3831) 2020-12-28 11:03:29 +08:00
ayodele.akingbule b68a0b3730 fix(emqx_lua_hook): fix dialyzer warnings. 2020-12-25 07:42:01 +08:00
Zaiming Shi 7bdd093ef5 Merge remote-tracking branch 'origin/dev/v4.3.0' into umbrella-fix-build 2020-12-11 08:55:57 +01:00
ayodele.akingbule 6973837829 fix(emqx_plugins): Dialyzer warnings 2020-12-10 23:34:36 +01:00
Ayodele 56d7b3deb1 Umbrella fix build (#8) 2020-12-10 11:25:25 +01:00
ayodele.akingbule 59d69b730b fix(emqx_logger): Dialyzer warnings 2020-12-10 11:22:38 +01:00
ayodele.akingbule b9b20ba268 fix(emqx.erl): Dialyzer warnings 2020-12-10 11:22:38 +01:00
ayodele.akingbule 62e0a21ad0 fix(emqx_auth_sys, emqx_ws_connection): Dialyzer warnings 2020-12-10 11:22:38 +01:00
ayodele.akingbule 18ae158f45 fix(emqx_plugins, emqx_sys, emqx_sys_mon, emqx_ws_connection): Dialyzer warnings 2020-12-10 11:22:38 +01:00
Zaiming Shi baaa4e847d fix(emqx_sn_gateway): Dialyzer warnings 2020-12-10 09:49:24 +01:00
Zaiming Shi eecd2b5f35 fix(emqx_types): Non mandatory map fields 2020-12-10 09:38:07 +01:00
Zaiming Shi adc9cc30f6 refactor(emqx_modules): Swallow errors when write modules 2020-12-10 09:35:36 +01:00
Zaiming Shi d47a2294ca fix(emqx_mod_topic_metrics): Dialyzer warnings 2020-12-10 09:35:36 +01:00
Zaiming Shi 0f0ca1e9fd fix(emqx_mod_rewrite): Dialyzer warnings 2020-12-10 09:35:36 +01:00
Zaiming Shi ab5599b3ec refactor(hook): Add emqx_hooks:put to hide already_exists error
This also fixes dialyzer warnings in emqx_mod_presence
2020-12-10 09:35:36 +01:00
Zaiming Shi 5793ef6640 fix(emqx_mod_sup): Dialyzer warning
All the callers of start_child API are discarding the return value.
2020-12-10 09:35:36 +01:00
Zaiming Shi f3d973689b fix(emqx_listeners): Dialyzer warnings 2020-12-10 09:35:36 +01:00
Zaiming Shi 7a39470200 fix(emqx_connection): Dialyzer warnings 2020-12-10 09:35:36 +01:00
Zaiming Shi 7dd67a6caf fix(emqx_channel): Dialyzer warning 2020-12-10 09:35:36 +01:00
Zaiming Shi cfe52cbb8d fix(emqx_broker): Dialyzer warning 2020-12-10 09:35:36 +01:00
Zaiming Shi 0eb697fa6f fix(emqx_app): Dialyzer warnings 2020-12-10 09:35:35 +01:00
Zaiming Shi 3fb69cc407 fix(emqx_alarm): Dialyzer warnings 2020-12-10 09:35:35 +01:00
Zaiming Shi 0d90d5c66b fix(emqx_acl_cache): Dialyzer warnings 2020-12-10 09:35:35 +01:00
Zaiming Shi d4aa5ebf55 fix(emqx): Fix dialyzer warnings 2020-12-10 09:35:35 +01:00
JianBo He 7f556d36d1
Merge branch 'dev/v4.3.0' into e422_to_v430 2020-12-09 11:28:36 +08:00
Zaiming Shi 6d1cd6b7ea refactor(emqx_password): move the module to emqx application
Future plugins will require emqx as a dependency.
This commit also brings back bcrypt to the system which was temporary
removed when converting to umbrella project
2020-12-08 22:09:59 +01:00
Shawn 0ee489a9be fix(congestion): change the conn congestion alarm msg body 2020-12-07 15:05:20 +08:00
Shawn d00ea48752 feature(tcp): alarm when tcp connection congested 2020-12-07 14:35:38 +08:00
JianBo He 505257b25b chore(appup): remeove the code_change codes 2020-12-05 17:22:44 +08:00
JianBo He ae9449a004 chore: eliminate diaylzer warnings 2020-12-05 17:20:50 +08:00
JianBo He f1b3bbd7bc chore: supply the code_change logic 2020-12-05 17:20:50 +08:00
JianBo He 3b1074d11f refactor(conn): not saving anonymous func 2020-12-05 17:11:58 +08:00
JianBo He 3f924631e4 refactor(limiter): not saving anonymous function 2020-12-05 17:03:57 +08:00
JianBo He 2e7ec25ae2 chore(appup): suspend esockd_acceptor 2020-12-05 15:04:14 +08:00
Zaiming Shi 73d02beace refactor(apps): Merge emqx_libs back to emqx
And move emqx app back to root level

After realising the challenges of developing plugins in standalone
rebar projects. it is perhaps more smooth to keep using emqx as
a rebar dependency
2020-12-04 19:58:58 +01:00
JianBo He 7462ed92ba chore: eliminate diaylzer warnings 2020-12-04 22:33:29 +08:00
JianBo He ca0f6b69a4 chore: supply the code_change logic 2020-12-04 22:33:29 +08:00
JianBo He 80c503fd64 refactor(conn): not saving anonymous func 2020-12-04 22:33:29 +08:00
JianBo He 40d272815a refactor(limiter): not saving anonymous function 2020-12-04 22:33:29 +08:00
Shawn f5162562a4
chore(appup): update appup 2020-11-26 10:42:35 +08:00
Shawn aa7124f3c9
chore(appup): use binding var 'VSN' 2020-11-25 14:40:25 +08:00
turtleDeng 3ca39cb9cb
chore(appup): update version 2020-11-25 10:27:56 +08:00
zhanghongtong 3f41adc3bd chore(appup): update version 2020-11-25 01:07:19 +08:00
zhanghongtong cf7c3b4f0c fix(appup): fix syntax error 2020-11-13 17:40:36 +08:00
zhanghongtong 253c43e405 feat(emqx_metrics): add new functions to count message received 2020-11-13 16:42:48 +08:00
turtled 41a8f2f811 Merge branch 'stable/e4.2.0' of https://github.com/emqx/emqx into stable/e4.2.0 2020-11-13 10:40:28 +08:00
turtled 77d777fd11 chore(acl): rollback emqx_access_rule module 2020-11-13 10:40:14 +08:00
terry-xiaoyu 8cc69e639f fix(congestion): change the conn congestion alarm msg body 2020-11-11 17:33:38 +08:00
turtled 26c03aaa43 feat(connection): update alarm info 2020-11-11 09:37:39 +08:00
zhanghongtong e100b0a5e9 feat(emqx_metrics): add new functions to count message received 2020-11-10 23:36:11 +08:00
Shawn cc69225b6d feature(tcp): alarm when tcp connection congested (#3818) 2020-11-10 23:36:11 +08:00
JianBo He 139306b61c fix(json): fix decoding/encoding empty object error 2020-11-10 23:36:11 +08:00
JianBo He b883e238bf fix(ws): take ws_cookie to clientinfo
see: https://github.com/emqx/emqx/issues/3747#issuecomment-702268570
2020-11-10 23:36:11 +08:00
terry-xiaoyu 5a8efd9d20 feature(project): move src to apps/emqx/src 2020-10-31 09:19:28 +08:00
JianBo He b373c0cf1b fix(json): fix decoding/encoding empty object error 2020-10-24 15:49:15 +08:00
zhouzb 8462da9652 fix(topic metrics): add appup.src 2020-10-24 11:21:39 +08:00
zhouzb b927bb7af6 fix(topic metrics): calculate the rate correctly 2020-10-24 11:21:39 +08:00
JianBo He 2feeb4d91f fix(ws): take ws_cookie to clientinfo
see: https://github.com/emqx/emqx/issues/3747#issuecomment-702268570
2020-10-24 11:21:39 +08:00
bignullnull 87ef4e4dd9 chore(types): Add the disconnected_at field definition in conninfo (#3764) 2020-10-24 11:21:39 +08:00
turtled eb4b9936dc fix(modules): fix conflicts 2020-10-11 11:12:39 +08:00
terry-xiaoyu 7b98f62f7a fix(config): enable force_shutdown_policy by default 2020-09-30 11:36:30 +08:00
tigercl da4d71917f fix(ignore-loop-deliver): fix issue#3738 (#3741) 2020-09-29 15:35:16 +08:00
JianBo He 76ec65830c fix: fix session_locking_strategy enum typos 2020-09-29 15:35:16 +08:00
zhanghongtong fa31062a5e chore(topic rewrite): export more functions 2020-09-11 12:37:47 +08:00
JianBo He 3d4eac7e7a fix(json): fix safe_encode for utf8 string 2020-09-11 12:26:13 +08:00
turtleDeng edcbdcce87 improve: module_acl_internal load/unload api (#3706) 2020-09-05 17:23:22 +08:00
JianBo He 90b33b044d feature(ratelimit): support to set ratelimit & quota policy 2020-09-05 17:23:22 +08:00
terry-xiaoyu 4233ef4e85 fix(xref): correct the type spec of logger_handler_info() 2020-08-28 17:10:26 +08:00
terry-xiaoyu 9985e2675c fix(logger): resolve issues when starting and stopping log handlers 2020-08-28 17:10:26 +08:00
terry-xiaoyu faf0b5289c feature(logger): support starting and stopping log handlers 2020-08-28 17:10:26 +08:00
JianBo He e411b4bad3 fix(cm): fix never matching clause 2020-08-28 17:10:26 +08:00
zhouzb 261bd66a3d refactor(alarm): refactor resource down alarm 2020-08-22 15:27:11 +08:00
zhouzb 7a2a01a4de fix(mqtt piggyback): bad data type 2020-08-22 15:27:11 +08:00
zhouzb ec12acc4ef feature(mqtt piggyback): transporting mutli MQTT packets at once or single 2020-08-22 15:27:11 +08:00
zhouzb cfcbc53a8b refactor(alarm): remove excess case 2020-08-22 15:27:11 +08:00
zhouzb c2cc8ab218 feature(resource-down-alarm): add resource down alarm 2020-08-22 15:27:11 +08:00
tigercl 901573c6a5 fix(topic-metrics): fix the issue that the corresponding data is not properly cleaned up when unregistering (#3679) 2020-08-22 15:27:11 +08:00
Rory Z f47e10e08a feature(emqx_mod_rewrite): separate rewrite rules for pub and sub (#3676) 2020-08-22 15:27:11 +08:00
zhouzb dbeabf3de0 refactor(telemetry): remove telemetry code from emqx core 2020-08-22 15:27:11 +08:00
JianBo He 9e5e6f2e98 fix(guid): compatible with OTP 23 2020-08-22 15:27:11 +08:00
zhanghongtong a76be8e0fa chore: fix the compilation error when there is "/" in the branch name 2020-08-22 15:27:11 +08:00
tigercl e37a70509b feature(telemetry): support for collecting telemetry data and disable it by default (#3653) 2020-08-14 16:58:08 +08:00
JianBo He 98faa698f3 feature(quota): add quota confs to limit the number of message forwards 2020-08-14 16:58:08 +08:00
JianBo He 89377aeaa2 improve(type): refine the message header types 2020-08-14 16:58:08 +08:00
zhouzb 87780c1c1b fix(static-cluster): fix the issue that static cluster failure caused by the wrong way of creating tables 2020-08-14 16:58:08 +08:00
zhouzb aaf29ee164 fix(alarm): fix the issue that memory watermark were not set correctly 2020-07-31 18:07:20 +08:00
zhouzb 1ba4743213 refactor(alarm): new data structure and support regular cleaning of deactivated alarms 2020-07-31 18:07:20 +08:00
zhouzb 5676026e2a fix(alarm): missing partition alarm 2020-07-31 18:07:20 +08:00
zhouzb 43b49edd28 feature(alarm): new design for alarm 2020-07-31 18:07:20 +08:00
zhanghongtong 0817761aee fix(emqx_channel): EMQ X replaces MQTT properties when node connects using "topic-alias-maximum" property 2020-07-31 18:07:20 +08:00
zhouzb 00bc525d8e refactor(add-log): log when subscription fails 2020-07-31 18:07:20 +08:00
JianBo He 83a2af812f feat(ratelimit): refactor ratelimit 2020-07-31 18:07:20 +08:00
zhanghongtong 961e7b9818 chore: update app.src.script 2020-07-20 10:08:47 +08:00
Rory Z 492d224728
Auto-pull-request-on-2020-07-17 (#3600)
* refactor(channel): skip the ACL checking for inner subscribe
* fix(props): fix the prop_emqx_sys results of judgment
* Update esockd to 5.7.1
* test(topic-metrics): add test cases for topic metrics
* perf(emqx_vm): make emqx_vm:get_memory/0 more efficiency
2020-07-17 18:25:46 +08:00
terry-xiaoyu 211c800e24 fix(properties): downlink will msg contains non-publish properties
The paho test failed because the client received a will message
that has an `Will-Delay-Interval` property.

All the 7 allowed PUBLISH properties are listed as follows:

```
'Payload-Format-Indicator',
'Message-Expiry-Interval',
'Response-Topic',
'Correlation-Data',
'User-Property',
'Subscription-Identifier',
'Content-Type'
```
2020-06-21 11:27:22 +08:00
JianBo He 600b1055f3 fix(json): convert a proplists to ejson instead of map 2020-06-20 15:42:07 +08:00
tigercl 1b6a586948
feature(mqtt): support response information (#3533) 2020-06-20 15:07:37 +08:00
zhanghongtong 8707afa54c fix(enhanced_auth): fix bug when "conn_props = undefined" 2020-06-20 14:29:20 +08:00
JianBo He 9a8859a44c refactor(topic): move triples/1 func into emqx_trie module 2020-06-18 17:38:34 +08:00
JianBo He e3489b9d46 refactor(style): improve all types declaration
- Add dialyzer for code analysis
- Correct all the module type declarations
- Use `-type()` to declaration a type instead of `-opaque`
  (It is advantageous to the code dialyzer)

BROKEN CHANGES:
- Add a ?DEFAULT_SUBOPTS for emqx_broker:subscribe/1,2,3
- Remove the needless internal function `emqx_vm:port_info(PortTerm, Keys)`
2020-06-18 17:38:34 +08:00
terry-xiaoyu 6ad65d587e feature(properties): add properties in message header
1. Add MQTT5.0 properties when invoking the hooks.

- Add a new key `properties` into the message header:

  We used to put all of the properties into the `#message.headers`:

  ```erlang
  #message{headers = #{'User-Property' => {<<"reason">>,<<"normal">>},
                       'Message-Expiry-Interval' => 60,
                       allow_publish => true}
  ```

  I put them instead under a single key:

  ```erlang
  #message{headers = #{properties =>
                        #{'User-Property' => {<<"reason">>,<<"normal">>},
                          'Message-Expiry-Interval' => 60},
                       allow_publish => true}
  ```

  Note that the column `properties` may contain all the properties for
  Publish and Will messages.

- Add `disconn_props` into the `Channel.conninfo`

- Add `puback_props` also into the message header:

  ```erlang
  #message{headers = #{puback_props =>
                        #{'User-Property' => {<<"reason">>,<<"normal">>}},
                       allow_publish => true}
  ```

2. Change the data type of `#message.headers` and `#message.flags` to map.

   It used to support `undefined`.
2020-06-17 18:46:26 +08:00
JianBo He ea2a424ce2
Add ensure/2 funcs to avoid needless logs (#3483) 2020-06-04 10:46:53 +08:00
zhouzb f456f40c59 Subscribe or unsubscribe via HTTP API skip ACL checking 2020-06-04 10:45:58 +08:00
JianBo He 42fc81338c Fix(modules): correct the bad return value for emqx_modules:load/0 2020-06-04 10:38:28 +08:00
JianBo He 3fb82f7234 Fix(connect): fix the race condition for openning session
- Remove the register_channel/1,2 functions
2020-06-02 17:21:06 +08:00
terry-xiaoyu 59f95f8421 Helpful message when no commands available 2020-05-23 09:41:25 +08:00
zhouzb 83b1f3e6c8 Fix unexpected packet before connected 2020-05-22 18:18:52 +08:00
JianBo He 18ae15ef9a Fix typos 2020-05-21 17:51:22 +08:00
terry-xiaoyu 1f07700930 Print helpful messages when no commands available 2020-05-16 08:48:05 +08:00
zhouzb 80e2bd19b9 Fix case_clause in issue#3455 2020-05-12 10:39:22 +08:00
JianBo He 48d6acdb25 Replace peercert with cn/dn feilds in ClientInfo 2020-04-30 16:35:15 +08:00
zhanghongtong c35a40a6b6 Fix some error for reauthentication 2020-04-28 11:48:07 +08:00