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

Re-arrange error handling a bit #529

Merged
merged 2 commits into from
Apr 15, 2020
Merged

Re-arrange error handling a bit #529

merged 2 commits into from
Apr 15, 2020

Conversation

Keno
Copy link
Contributor

@Keno Keno commented Apr 15, 2020

If we did throw an error and tried to close the connection,
there's no reason to try to do so again during the finally block.
Also, if we are in the error block, close(io) has quite a high chance
for failing, so wrap it in try to suppress such errors and instead
rethrow the original error.

@Keno
Copy link
Contributor Author

Keno commented Apr 15, 2020

This isn't quite right. I'll fix it in the morning.

@Keno Keno force-pushed the kf/errorrearrange branch from a3426f8 to 3847917 Compare April 15, 2020 10:20
Keno added 2 commits April 15, 2020 12:06
If we did throw an error and tried to close the connection,
there's no reason to try to do so again during the finally block.
Also, if we are in the error block, close(io) has quite a high chance
for failing, so wrap it in try to suppress such errors and instead
rethrow the original error.
Closing the connection is a courtesy for the remote end,
and one that is usually repayed by having the remote slam
shut, which causes us to error. Don't propogate those errors
to the user - instead only propagate errors from the read
and the write end.
@Keno Keno force-pushed the kf/errorrearrange branch from 3847917 to 5a118fe Compare April 15, 2020 16:07
@Keno
Copy link
Contributor Author

Keno commented Apr 15, 2020

I've pushed another commit here that tries to propagate the correct error to the user. Before this, e.g. the AWS retry layer would get very mad at the random errors thrown by these close functions and just retry a request that failed for good reason.

return r
catch e
@debug 1 "❗️ ConnectionLayer $e. Closing: $io"
try; close(io); catch; end
Copy link
Member

Choose a reason for hiding this comment

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

I think this is why we say close shouldn't error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah...

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.

3 participants