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 counter leak in nonsuper_connections #1069

Conversation

percona-ysorokin
Copy link
Contributor

Summary:
If a non-super user connects to mysqld with an invalid database name,
nonsuper_connections is incremented, but never decremented.

Originally Reviewed By: yizhang82

fbshipit-source-id: a9083cc

8.0 porting notes:
Since nonsuper_connections is already decremented by calling
release_user_connection(), changes to the code are not needed. Test is
ported though to make sure the leak won't appear again.

Summary:
If a non-super user connects to mysqld with an invalid database name,
nonsuper_connections is incremented, but never decremented.

Originally Reviewed By: yizhang82

fbshipit-source-id: a9083cc

8.0 porting notes:
Since nonsuper_connections is already decremented by calling
release_user_connection(), changes to the code are not needed. Test is
ported though to make sure the leak won't appear again.
@percona-ysorokin
Copy link
Contributor Author

nonsuper_connections is incremented in

nonsuper_connections++;
.
Then, as a requested database doesn't exist, release_user_connection() is called at
release_user_connection(thd);
, which in turn decrements the counter:
nonsuper_connections--;
. That's why the test succeeds, and no code changes are necessary.

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@hermanlee has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@hermanlee hermanlee closed this Dec 30, 2019
facebook-github-bot pushed a commit that referenced this pull request Dec 30, 2019
Summary:
If a non-super user connects to mysqld with an invalid database name,
nonsuper_connections is incremented, but never decremented.

Squash with D13987618

8.0 porting notes:
Since nonsuper_connections is already decremented by calling
release_user_connection(), changes to the code are not needed. Test is
ported though to make sure the leak won't appear again.

Reference Patch: 3cc5162fdc2

Pull Request resolved: #1069

Reviewed By: yizhang82

Differential Revision: D19129736

Pulled By: hermanlee

fbshipit-source-id: 64a9117
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants