Skip to content

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

Merged
dabcoder merged 2 commits intoDataDog:masterfrom
charettes:patch-1
Jan 10, 2020
Merged

[dogstatsd] Handle OSError on socket.close on Python 3.6+#510
dabcoder merged 2 commits intoDataDog:masterfrom
charettes:patch-1

Conversation

@charettes
Copy link
Copy Markdown
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
Copy Markdown

@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.

Co-Authored-By: David Bouchare <david.bouchare@datadoghq.com>
@dabcoder
Copy link
Copy Markdown

dabcoder commented Jan 9, 2020

/azp run DataDog.datadogpy.integration

@azure-pipelines
Copy link
Copy Markdown

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
Copy Markdown
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.

4 participants