Commit Graph

752 Commits

Author SHA1 Message Date
zhongwencool b592565363 fix: trace not work if client is utf8 2021-12-15 09:53:46 +08:00
JimMoen d76159d543 Merge remote-tracking branch 'emqx/main-v4.3' into sync-from-v4.3 2021-12-13 18:46:23 +08:00
Ilya Averyanov c410571ee2 fix(wss): update cowboy & ranch for OTP24 compatibility 2021-12-10 20:39:25 +03:00
JimMoen 3ecc79e1bc test(frame): test packet proxy_protocol config disabled 2021-12-10 18:08:47 +08:00
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
zhongwencool 2c2145dfe6 Merge branch 'main-v4.3' into sync-from-4.3 2021-12-07 23:20:01 +08:00
zhongwencool d4dd4a124c fix: trace_name format [A-Za-z0-9-_];waiting status if create time to closed" 2021-12-06 20:51:42 +08:00
zhongwencool 0d218df14d fix: replace ct:sleep/1 by filesync/2 2021-11-29 23:08:56 +08:00
lafirest fef3fc27cb
refactor(emqx_slow_subs): refactor use moving average (#6287)
* refactor(emqx_slow_subs): refactor use moving average

* fix(emqx_slow_subs): change elapsed to latency, and fix some error

* fix(emqx_slow_subs): fix emqx_mgmt_api.erl indent

* fix(emqx_slow_subs): change api name

* fix(emqx_slow_subs): fix and improve some code

* fix(emqx_slow_subs): move clienid filed from latency_stats to session
2021-11-26 10:42:15 +08:00
Thales Macedo Garitezi 0260db6640
feat(sys_mon): Add proc_lib:initial_call/1 and current_stacktrace (4.3)
(Same as #6289 )

This adds the information from `proc_lib:initial_call/1` and the
current stacktrace from the process info to `emqx_sys_mon:procinfo/1`
to aid in debugging some warnings with no context such as the
following:

```
2021-11-23T12:33:59.387818+00:00 [warning] info: [{old_heap_block_size,45988046},{heap_block_size,22177879},{mbuf_size,0},{stack_size,40},{old_heap_size,22354134},{heap_size,7106339}], line: 130, mfa: emqx_sys_mon:handle_info/2, msg: large_heap, procinfo: [{pid,<0.2667.0>},{memory,579763664},{total_heap_size,68510672},{heap_size,22177879},{stack_size,40},{min_heap_size,233},{initial_call,{proc_lib,init_p,5}},{current_function,{gen,do_call,4}},{registered_name,[]},{status,running},{message_queue_len,360945},{group_leader,<0.1660.0>},{priority,normal},{trap_exit,false},{reductions,16493271},{last_calls,false},{catchlevel,4},{trace,0},{suspending,[]},{sequential_trace_token,[]},{error_handler,error_handler}]
```
2021-11-25 12:08:02 -03:00
JimMoen 289415b5aa fix(conf): change `max_topic_levels` default configuration 2021-11-25 09:52:12 +08:00
Zaiming (Stone) Shi 2514f474b0
Sync v4.3 to v4.4 (#6262)
* fix(http): fix duplicate http headers

* chore(appup): add appup.src

* fix(appup): fix multiply defined module in appup

* chore(appup): fix wrong version

* chore(ekka): Bump version to 0.8.1.5

* fix(update_appup): Fix warnings, add support for external repos

* build: use find command's -delete option

* ci: do not sync master branch

* build: ensure openssl11

* build: copy only libcrypto and libtinfo

* fix(trace): handler_id now always return atom

Co-authored-by: zhouzb <zhouzb@emqx.io>
Co-authored-by: k32 <10274441+k32@users.noreply.github.com>
2021-11-23 09:33:20 +08:00
Zaiming Shi 0f52824872 refactor(trace): hash non-printable or too long names 2021-11-22 16:59:17 +01:00
zhongwencool 30fb9dd7ae fix: name must be printable unicode and len < 256 2021-11-22 22:20:02 +08:00
zhongwencool d76275d17d feat: add support ip_address trace options 2021-11-22 15:20:24 +08:00
zhouzb 5e3fe6714e fix(http): fix duplicate http headers 2021-11-17 14:14:12 +08:00
Zaiming Shi d05e2ff0b1 Merge remote-tracking branch 'origin/main-v4.3' into main-v4.4-alpha.1 2021-11-15 13:41:51 +01:00
Zaiming Shi 74b6b5214a test(emqx_cm_SUITE): add a gen_server call sync 2021-11-11 10:33:31 +01:00
zhongwencool 835ad52498
feat(trace): http api for trace (#6052)
* feat(trace): add http trace API

* feat: sub/unsub trace topic

* chore(trace): stream log use _page and _limit

* fix: elvis warning

* fix: mod_trace test failed

* fix: http api meta rename _page/_limit to _page/_limit

* fix: clientid string not working

* fix: add emqx_mod_trace to module

* fix(trace): fixed by review suggestions
2021-11-11 14:54:40 +08:00
zhongwencool 06a1b37992
fix(test): flaky mqtt expiry test case. (#6111) 2021-11-10 15:41:31 +08:00
zhongwencool fa34d8353e
fix(test): flaky mqtt expiry test case. (#6112) 2021-11-10 15:40:46 +08:00
Thales Macedo Garitezi b9270ad719
feat(stats): track live / connected channel count for monitoring
In order to correctly display the number of connected clients in our
monitor dashboard, we need to track those connections that are
actually connected to clients, not considering connections from
persistent sessions that are disconnected.  Today, the
`connections.count` that is displayed in the dashboards considers
those disconnected persistent sessions as well.
2021-11-08 14:45:57 -03:00
Zaiming Shi 7f4809f61a fix(session): force kill session for 'kick' and 'discard'
Prior to this fix, 'kick' and 'discard' calls may timeout (or
fail for other reason), failures lead to only a log, then
continue to allow the new session to get registered.

As a result, in case a client is stuck, there is no way to
force it to step down, end up with multiple connections (sessions)
for the client ID in dashboard.

After this fix, the stale pids are notified to shutdown
via a gen_server:call, and forced with a exit(Pid, kill) for any
exception happend to the gen_server:call
2021-10-30 16:38:36 +02:00
Zaiming Shi 9038da0bd2 fix(ws_connection): check origin failure should return 403 not 500 2021-10-15 15:49:26 +08:00
Zaiming Shi 7c1ce8bc70 chore: fix flaky test cm_SUITE open session racecondition 2021-10-07 11:53:53 +02:00
Zaiming Shi 3fa442f4a4 test(emqx_broker): fix flaky tests 2021-10-05 20:55:36 +02:00
JimMoen 2dba91d6d0 chore(test): variable integer test. 2021-09-28 15:15:05 +08:00
k32 5fc1036cf7 chore(mqueue): Implement live upgrade 2021-09-06 23:15:14 +02:00
k32 4eacaa29bd feat(mqueue): Interleave messages with different priorities 2021-09-06 22:22:48 +02:00
Turtle 6aa61ea78d fix(test): Increase the delay time 2021-08-13 17:29:51 +08:00
Rory Z ff96250b0b chore(tests): fix conunt error 2021-08-06 15:31:32 +08:00
Turtle c45de03ac8 chore(version): update emqx version to 4.3.7
Signed-off-by: zhanghongtong <rory-z@outlook.com>
2021-08-05 10:00:03 +08:00
JianBo He 07c29e8c55 chore(acl): support ipaddr list 2021-07-28 13:54:13 +08:00
Zaiming Shi cddfa928b1 test: deterministic tests 2021-06-05 19:53:56 +02:00
Zaiming Shi 8bf3c511d8 test: fix a flacky test case 2021-06-04 16:04:58 +02:00
Tobias Lindahl 18484577b1 test: enable non-running test suite
Due to a name clash a ct testsuite was previously not running.
2021-06-03 10:42:51 +02:00
JianBo He 3a89b1f00b
chore(action): fix syntax error (#4885) 2021-05-31 15:08:52 +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 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 8443aa5e21 chore(typo): sepecial -> special 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 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 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 05c5378265 feat(http_lib): add normalise_headers API 2021-05-07 10:14:19 +08: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 29475eb610 feat(emqx_http_lib): try to parse host ip 2021-04-28 10:43:36 +02:00
Zaiming Shi eb946eb80c fix(emqx_trie): do not try to match wildcard topics 2021-04-26 14:18:40 +02:00