Merge pull request #10078 from qzhuyan/fix/william/inval-listener-options-segfault
fix: inval listener option cause segfault
This commit is contained in:
commit
422f8e3be3
|
@ -24,7 +24,7 @@ IsQuicSupp = fun() ->
|
|||
end,
|
||||
|
||||
Bcrypt = {bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {tag, "0.6.0"}}},
|
||||
Quicer = {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.111"}}}.
|
||||
Quicer = {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.113"}}}.
|
||||
|
||||
Dialyzer = fun(Config) ->
|
||||
{dialyzer, OldDialyzerConfig} = lists:keyfind(dialyzer, 1, Config),
|
||||
|
|
|
@ -537,10 +537,12 @@ ensure_quic_listener(Name, UdpPort, ExtraSettings) ->
|
|||
mountpoint => <<>>,
|
||||
zone => default
|
||||
},
|
||||
emqx_config:put([listeners, quic, Name], maps:merge(Conf, ExtraSettings)),
|
||||
case emqx_listeners:start_listener(quic, Name, Conf) of
|
||||
Conf2 = maps:merge(Conf, ExtraSettings),
|
||||
emqx_config:put([listeners, quic, Name], Conf2),
|
||||
case emqx_listeners:start_listener(emqx_listeners:listener_id(quic, Name)) of
|
||||
ok -> ok;
|
||||
{error, {already_started, _Pid}} -> ok
|
||||
{error, {already_started, _Pid}} -> ok;
|
||||
Other -> throw(Other)
|
||||
end.
|
||||
|
||||
%%
|
||||
|
|
|
@ -33,7 +33,8 @@ all() ->
|
|||
{group, mstream},
|
||||
{group, shutdown},
|
||||
{group, misc},
|
||||
t_listener_with_lowlevel_settings
|
||||
t_listener_with_lowlevel_settings,
|
||||
t_listener_inval_settings
|
||||
].
|
||||
|
||||
groups() ->
|
||||
|
@ -1885,8 +1886,17 @@ t_multi_streams_sub_0_rtt_stream_data_cont(Config) ->
|
|||
ok = emqtt:disconnect(C),
|
||||
ok = emqtt:disconnect(C0).
|
||||
|
||||
t_listener_inval_settings(_Config) ->
|
||||
LPort = select_port(),
|
||||
%% too small
|
||||
LowLevelTunings = #{stream_recv_buffer_default => 1024},
|
||||
?assertThrow(
|
||||
{error, {failed_to_start, _}},
|
||||
emqx_common_test_helpers:ensure_quic_listener(?FUNCTION_NAME, LPort, LowLevelTunings)
|
||||
).
|
||||
|
||||
t_listener_with_lowlevel_settings(_Config) ->
|
||||
LPort = 24567,
|
||||
LPort = select_port(),
|
||||
LowLevelTunings = #{
|
||||
max_bytes_per_key => 274877906,
|
||||
%% In conf schema we use handshake_idle_timeout
|
||||
|
@ -1897,7 +1907,7 @@ t_listener_with_lowlevel_settings(_Config) ->
|
|||
%% tls_client_max_send_buffer,
|
||||
tls_server_max_send_buffer => 10240,
|
||||
stream_recv_window_default => 1024,
|
||||
stream_recv_buffer_default => 1024,
|
||||
stream_recv_buffer_default => 10240,
|
||||
conn_flow_control_window => 1024,
|
||||
max_stateless_operations => 16,
|
||||
initial_window_packets => 1300,
|
||||
|
@ -1936,8 +1946,7 @@ t_listener_with_lowlevel_settings(_Config) ->
|
|||
{ok, _, [_SubQos]} = emqtt:subscribe_via(C, {new_data_stream, []}, #{}, [
|
||||
{<<"test/1/3">>, [{qos, 2}]}
|
||||
]),
|
||||
ok = emqtt:disconnect(C),
|
||||
emqx_listeners:stop_listener(emqx_listeners:listener_id(quic, ?FUNCTION_NAME)).
|
||||
ok = emqtt:disconnect(C).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Helper functions
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Fix an issue that invalid QUIC listener setting could casue segfault.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
修复了无效的 QUIC 监听器设置可能导致 segfault 的问题。
|
||||
|
2
mix.exs
2
mix.exs
|
@ -648,7 +648,7 @@ defmodule EMQXUmbrella.MixProject do
|
|||
defp quicer_dep() do
|
||||
if enable_quicer?(),
|
||||
# in conflict with emqx and emqtt
|
||||
do: [{:quicer, github: "emqx/quic", tag: "0.0.111", override: true}],
|
||||
do: [{:quicer, github: "emqx/quic", tag: "0.0.113", override: true}],
|
||||
else: []
|
||||
end
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ bcrypt() ->
|
|||
{bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {tag, "0.6.0"}}}.
|
||||
|
||||
quicer() ->
|
||||
{quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.111"}}}.
|
||||
{quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.113"}}}.
|
||||
|
||||
jq() ->
|
||||
{jq, {git, "https://github.com/emqx/jq", {tag, "v0.3.9"}}}.
|
||||
|
|
Loading…
Reference in New Issue