Skip to content

Close SSL sockets when connections/validations fail #3318

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

Merged

Conversation

kurtmckee
Copy link
Contributor

Fixes #3317

Pull Request check-list

Please make sure to review and check all of these items:

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?

Note

CI may fail, as it currently does on the master branch, but because the SSL sockets are getting closed, the ResourceWarning displayed as pytest exits are now resolved.

  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?
  • Was the change added to CHANGES file?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Description of change

As noted in #3317, there are two places where SSL sockets might not get closed, and they both stem from a RedisError getting raised when either of two validation checks fail. This PR addresses the issue in these ways:

  • RedisError is now caught in addition to OSError so the first open socket can be closed
  • The second open socket is only created after two validations have passed.

@gerzse gerzse added the maintenance Maintenance (CI, Releases, etc) label Jul 17, 2024
@kurtmckee
Copy link
Contributor Author

@gerzse I'll resolve the merge conflict in CHANGES and update this PR shortly.

@kurtmckee kurtmckee force-pushed the fix-ssl-socket-resource-warnings-issue-3317 branch from d688ea6 to 5e0a114 Compare July 17, 2024 11:25
@kurtmckee
Copy link
Contributor Author

Rebased on master, resolved merge conflict, and force-pushed changes.

@gerzse
Copy link
Contributor

gerzse commented Jul 17, 2024

Thanks @kurtmckee !

@gerzse gerzse merged commit 9607608 into redis:master Jul 17, 2024
56 checks passed
@kurtmckee kurtmckee deleted the fix-ssl-socket-resource-warnings-issue-3317 branch July 17, 2024 14:29
vladvildanov pushed a commit that referenced this pull request Sep 27, 2024
Handle more cases of failure when initializing SSL sockets, and make
sure no socket is left unclosed in case of errors.

Fixes #3317
vladvildanov pushed a commit that referenced this pull request Sep 27, 2024
Handle more cases of failure when initializing SSL sockets, and make
sure no socket is left unclosed in case of errors.

Fixes #3317
vladvildanov pushed a commit that referenced this pull request Sep 27, 2024
Handle more cases of failure when initializing SSL sockets, and make
sure no socket is left unclosed in case of errors.

Fixes #3317
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Maintenance (CI, Releases, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unclosed SSL sockets cause ResourceWarnings
2 participants