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

Close Unix sockets if the connection attempt fails #3315

Merged

Conversation

kurtmckee
Copy link
Contributor

@kurtmckee kurtmckee commented Jul 12, 2024

Fixes #3314

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)?
  • 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

This PR introduces the following change:

  • When a call to .connect() to a Unix socket raises an exception, the socket instance is immediately closed. This prevents a ResourceWarning that would otherwise occur (though Python typically doesn't display this warning).

@gerzse gerzse added the maintenance Maintenance (CI, Releases, etc) label Jul 17, 2024
@gerzse gerzse merged commit b2179f6 into redis:master Jul 17, 2024
55 checks passed
@kurtmckee kurtmckee deleted the fix-unix-socket-resource-warning-issue-3314 branch July 17, 2024 11:22
vladvildanov pushed a commit that referenced this pull request Sep 27, 2024
Make sure Unix sockets get closed if the connection fails.

Fixes #3314
vladvildanov pushed a commit that referenced this pull request Sep 27, 2024
Make sure Unix sockets get closed if the connection fails.

Fixes #3314
vladvildanov pushed a commit that referenced this pull request Sep 27, 2024
Make sure Unix sockets get closed if the connection fails.

Fixes #3314
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 Unix socket causes ResourceWarning
2 participants