Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: api_listener crash when setting max_connnections as string #11042

Merged
merged 2 commits into from Jun 14, 2023

Conversation

zhongwencool
Copy link
Member

@zhongwencool zhongwencool commented Jun 14, 2023

Fixes https://emqx.atlassian.net/browse/EMQX-10271

if we setting max_connection as string via conf file.

listeners.tcp.default {
     bind = "0.0.0.0:1883"
     max_connections = "1234"
}

we will get raw_conf as

> emqx_conf:get_raw([listeners,tcp,default]).
#{<<"bind">> => <<"0.0.0.0:1883">>, <<"max_connections">> => <<"1234">>
> emqx_conf:get([listeners,tcp,default]).
#{bind => {{0,0,0,0},1883}, max_connections => 1234}

the raw_conf's max_connections is binary, not a integer.
ideally we should check config failed by hocon when put a string as integer.
I choose to fix this quickly in emqx lib.

Summary

🤖 Generated by Copilot at 091c492

This pull request adds a feature to limit the number of concurrent connections for each listener, and improves the handling of the max_connections parameter in the management API and the internal configuration. It also adds some test cases to verify the functionality and consistency of the feature.

PR Checklist

Please convert it to a draft if any of the following conditions are not met. Reviewers may skip over until all the items are checked:

  • Added tests for the changes
  • Changed lines covered in coverage report
  • Change log has been added to changes/{ce,ee}/(feat|perf|fix)-<PR-id>.en.md files
  • For internal contributor: there is a jira ticket to track this change
  • If there should be document changes, a PR to emqx-docs.git is sent, or a jira ticket is created to follow up
  • Schema changes are backward compatible

Checklist for CI (.github/workflows) changes

  • If changed package build workflow, pass this action (manual trigger)
  • Change log has been added to changes/ dir for user-facing artifacts update

@zhongwencool zhongwencool requested review from a team, lafirest and sstrigler as code owners June 14, 2023 03:28
@HJianBo HJianBo merged commit 86d3b70 into emqx:release-51 Jun 14, 2023
109 checks passed
@yanzhiemq
Copy link
Collaborator

yanzhiemq commented Jun 15, 2023

Bug Fixes

  • Fixed crash on REST API GET /listeners when listener’s max_connections is set to a string.

@yanzhiemq
Copy link
Collaborator

yanzhiemq commented Jun 15, 2023

修复

  • 修复了当监听器的 max_connections 配置设为字符串时 REST API GET /listeners 崩溃的问题。

@zhongwencool zhongwencool deleted the max-connections-string branch December 15, 2023 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants