Skip to content

Handle more socket exceptions#349

Merged
ofek merged 4 commits intoDataDog:masterfrom
dabcoder:davidb/handle-exceptions
Feb 5, 2019
Merged

Handle more socket exceptions#349
ofek merged 4 commits intoDataDog:masterfrom
dabcoder:davidb/handle-exceptions

Conversation

@dabcoder
Copy link
Copy Markdown

Attempts to fix #212.

gzussa
gzussa previously requested changes Jan 25, 2019
except socket.error:
except (socket.error, socket.herror, socket.gaierror) as se:
log.info("Error submitting packet, dropping the packet and closing the socket")
self.close_socket()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we be closing the socket in the second except clause as well?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Not sure, # If set, use socket directly, would the last exception cover the case of not using the socket and thus not needing to close it? Or am I on the wrong track there?

Copy link
Copy Markdown
Contributor

@ofek ofek left a comment

Choose a reason for hiding this comment

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

This doesn't address the threading issue. You need to put a lock in get_socket.

@dabcoder dabcoder force-pushed the davidb/handle-exceptions branch from 68cc551 to 86211db Compare January 29, 2019 17:55
@gzussa gzussa dismissed their stale review February 5, 2019 09:44

Looks good to me but I would like @ofek to confirm as well regarding the lock

Co-Authored-By: dabcoder <david.bouchare@datadoghq.com>
@ofek ofek changed the title Handle all exceptions Handle more socket exceptions Feb 5, 2019
@ofek ofek merged commit a058b90 into DataDog:master Feb 5, 2019
@dabcoder dabcoder deleted the davidb/handle-exceptions branch October 16, 2019 08:10
dabcoder pushed a commit to dabcoder/datadogpy that referenced this pull request Oct 25, 2019
* Handle all exceptions

* Change log levels and increase max line for tests

* Add lock to address threading issues

* Remove conversion to str

Co-Authored-By: dabcoder <david.bouchare@datadoghq.com>
dabcoder pushed a commit to dabcoder/datadogpy that referenced this pull request Nov 28, 2019
* Handle all exceptions

* Change log levels and increase max line for tests

* Add lock to address threading issues

* Remove conversion to str

Co-Authored-By: dabcoder <david.bouchare@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

not all exceptions being caught

6 participants