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

Limit number of sessions that are created by same client ip and same user for each graphd #3729

Merged
merged 27 commits into from
Mar 16, 2022

Conversation

carrey-feng
Copy link
Contributor

@carrey-feng carrey-feng commented Jan 14, 2022

What type of PR is this?

  • bug
  • feature
  • enhancement

What problem(s) does this PR solve?

Issue(s) number:

Description:
#3696 provides the ability to delete sessions offline after too sessions are created. It is too late to ensure cluster availability, I think that we should do something to avoid too many session being created. Now there is already max_allowed_connections to limit total number of sessions in cluster to make sure the cluster does not crash because there are too many sessions. But it is not unfair to users who correctly use clusters.
So I add max_sessions_per_ip_per_user configuration to limit the number of sessions that are created by same client ip and same user on a graphd service . The default value is 300, You can set it in nebula-graphd.conf file.

How do you solve it?

So I add max_sessions_per_ip_per_user configuration to limit the number of sessions that are created by same client ip and same user on a graphd service . The default value is 300, You can set it in nebula-graphd.conf file.

Special notes for your reviewer, ex. impact of this fix, design document, etc:

Checklist:

Tests:

  • Unit test(positive and negative cases)
  • Function test
  • Performance test
  • N/A

Affects:

  • Documentation affected (Please add the label if documentation needs to be modified.)
  • Incompatibility (If it breaks the compatibility, please describe it and add the label.)
  • If it's needed to cherry-pick (If cherry-pick to some branches is required, please label the destination version(s).)
  • Performance impacted: Consumes more CPU/Memory

Release notes:

Please confirm whether to be reflected in release notes and how to describe:

ex. Fixed the bug .....

@CLAassistant
Copy link

CLAassistant commented Jan 14, 2022

CLA assistant check
All committers have signed the CLA.

@carrey-feng carrey-feng changed the title Limit number of sessions that are created by same ip and same user Limit number of sessions that are created by same client ip and same user for each graphd Jan 14, 2022
@carrey-feng
Copy link
Contributor Author

Limiting the number of individual user connections is required in a multi tenant cluster. It can prevent one user's mistake from affecting all other users

@Hera-han
Copy link

Hera-han commented Feb 28, 2022

@CPWstatic this PR has been open for a long time, please take a look and give feedback. thanks

@Sophie-Xie Sophie-Xie added the community Source: who proposed the issue label Feb 28, 2022
CPWstatic
CPWstatic previously approved these changes Mar 7, 2022
Copy link
Contributor

@CPWstatic CPWstatic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Contributor

@Aiee Aiee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for being back late, and thank you for addressing this problem.
Please take a look at the comments.

tests/job/test_session.py Outdated Show resolved Hide resolved
src/graph/session/GraphSessionManager.cpp Outdated Show resolved Hide resolved
src/graph/session/GraphSessionManager.cpp Outdated Show resolved Hide resolved
src/graph/session/GraphSessionManager.cpp Outdated Show resolved Hide resolved
src/graph/session/GraphSessionManager.h Outdated Show resolved Hide resolved
@Aiee Aiee added the ready-for-testing PR: ready for the CI test label Mar 8, 2022
@Aiee
Copy link
Contributor

Aiee commented Mar 8, 2022

LGTM.
Please fix the format reported in https://github.com/vesoft-inc/nebula/runs/5461460167?check_suite_focus=true

@carrey-feng
Copy link
Contributor Author

LGTM. Please fix the format reported in https://github.com/vesoft-inc/nebula/runs/5461460167?check_suite_focus=true

I have fixed the format reported, I find that there is not any whitespace at line ending in code. Why did they report an error?

@Aiee
Copy link
Contributor

Aiee commented Mar 8, 2022

LGTM. Please fix the format reported in https://github.com/vesoft-inc/nebula/runs/5461460167?check_suite_focus=true

I have fixed the format reported, I find that there is not any whitespace at line ending in code. Why did they report an error?

You could use clang-format to format the code. The style config file .clang-format is located at the root of the directory.

Ref: https://clang.llvm.org/docs/ClangFormat.html

@carrey-feng
Copy link
Contributor Author

@Aiee I have formated code by clang-format. Please approve running workflows thanks

@Aiee
Copy link
Contributor

Aiee commented Mar 10, 2022

@Aiee I have formated code by clang-format. Please approve running workflows thanks

Please check https://github.com/vesoft-inc/nebula/runs/5489976984?check_suite_focus=true
We are using 2 spaces as the indent.

@carrey-feng
Copy link
Contributor Author

BTW, you need to add 冯亮(26011345) to your GitHub account so that all committers could sign the CLA
冯亮(26011345) is my company's system account, I forget to change the Git configuration when I sometimes submitted.

Good job! Thank you for your contribution.

Thank you for your patience and help

You are welcome! :D We look forward to seeing you in the community again! BTW, you need to add 冯亮(26011345) to your GitHub account so that all committers could sign the CLA Screen Shot 2022-03-10 at 18 43 05

冯亮(26011345) is my system account in my company , I forget to change the Git configuration when I submitted. It is not a github account, can we ignore it?

@Aiee
Copy link
Contributor

Aiee commented Mar 10, 2022

BTW, you need to add 冯亮(26011345) to your GitHub account so that all committers could sign the CLA
冯亮(26011345) is my company's system account, I forget to change the Git configuration when I sometimes submitted.

Good job! Thank you for your contribution.

Thank you for your patience and help

You are welcome! :D We look forward to seeing you in the community again! BTW, you need to add 冯亮(26011345) to your GitHub account so that all committers could sign the CLA Screen Shot 2022-03-10 at 18 43 05

冯亮(26011345) is my system account in my company , I forget to change the Git configuration when I submitted. It is not a github account, can we ignore it?

Unfortunately, it is mandatory to sign the CLA. You could add the email address used for this commit to your account and may remove your working email later.

@carrey-feng
Copy link
Contributor Author

@Aiee
This problem has been resolved
image

CPWstatic
CPWstatic previously approved these changes Mar 14, 2022
@Aiee
Copy link
Contributor

Aiee commented Mar 14, 2022

@a516072575 Please take a look at the failed pytest case. You could run the test locally before pushing the commit.

@Sophie-Xie Sophie-Xie added the doc affected PR: improvements or additions to documentation label Mar 14, 2022
@Sophie-Xie
Copy link
Contributor

@a516072575 Please take a look at the failed pytest case. You could run the test locally before pushing the commit.

https://github.com/vesoft-inc/nebula/runs/5533203149?check_suite_focus=true

E nebula3.Exception.AuthFailedException: b"Create Session failed: Too many sessions created from 127.0.0.1 by user root. the threshold is 1. You can change it by modifying 'max_sessions_per_ip_per_user' in nebula-graphd.conf"

@CPWstatic
Copy link
Contributor

Please add max_sessions_per_ip_per_user to nebula-graphd.conf.production file.

@Sophie-Xie Sophie-Xie added incompatible PR: incompatible with the recently released version labels Mar 15, 2022
@carrey-feng
Copy link
Contributor Author

E nebula3.Exception.AuthFailedException: b"Create Session failed: Too many sessions created from 127.0.0.1 by user root. the threshold is 1. You can change it by modifying 'max_sessions_per_ip_per_user' in nebula-graphd.conf"

I will complete it as soon as possible

@carrey-feng
Copy link
Contributor Author

@a516072575 Please take a look at the failed pytest case. You could run the test locally before pushing the commit.

https://github.com/vesoft-inc/nebula/runs/5533203149?check_suite_focus=true

E nebula3.Exception.AuthFailedException: b"Create Session failed: Too many sessions created from 127.0.0.1 by user root. the threshold is 1. You can change it by modifying 'max_sessions_per_ip_per_user' in nebula-graphd.conf"

I will fix it today

@carrey-feng carrey-feng dismissed stale reviews from CPWstatic and Aiee via 616c06c March 15, 2022 04:49
@carrey-feng carrey-feng requested a review from a team as a code owner March 15, 2022 04:49
Copy link
Contributor

@Aiee Aiee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We made it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Source: who proposed the issue doc affected PR: improvements or additions to documentation incompatible PR: incompatible with the recently released version ready for review ready-for-testing PR: ready for the CI test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants