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

[dogstatsd] Handle OSError on socket.close on Python 3.6+ #510

Merged
merged 2 commits into from
Jan 10, 2020

Conversation

charettes
Copy link
Contributor

What does this PR do?

This PR handles unexpected exceptions in DogStatsd.close_socket().

Under certain obscure circumstances we get a crash on Python 3.6+ if the file descriptor vanishes before close is called.

See https://bugs.python.org/issue29343

Since Python 3.6 it's possible for socket.close to raise an OSError EBADF
when the socket's fd is already closed.

https://bugs.python.org/issue29343
@charettes charettes requested a review from a team as a code owner January 8, 2020 17:24
Copy link
Contributor

@dabcoder dabcoder left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution! Left a note.

datadog/dogstatsd/base.py Outdated Show resolved Hide resolved
Co-Authored-By: David Bouchare <david.bouchare@datadoghq.com>
@dabcoder
Copy link
Contributor

dabcoder commented Jan 9, 2020

/azp run DataDog.datadogpy.integration

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@dabcoder dabcoder merged commit c880fac into DataDog:master Jan 10, 2020
@charettes charettes deleted the patch-1 branch January 10, 2020 15:33
@charettes
Copy link
Contributor Author

Thanks for the quick merge folks.

@zippolyte zippolyte added the changelog/Fixed Fixed features results into a bug fix version bump label Feb 4, 2020
@zippolyte zippolyte changed the title Handle OSError on socket.close on Python 3.6+ [dogstatsd] Handle OSError on socket.close on Python 3.6+ Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog/Fixed Fixed features results into a bug fix version bump resource/dogstatsd
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants