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

Expose a function to check if a hyper::Error is due to a BodyWrite #3609

Open
ClementTsang opened this issue Mar 23, 2024 · 2 comments
Open
Labels
C-feature Category: feature. This is adding a new feature.

Comments

@ClementTsang
Copy link

ClementTsang commented Mar 23, 2024

Is your feature request related to a problem? Please describe.

Originally reported in apache/arrow-rs#5545, where they pointed me to ask some questions here. The gist of the problem is:

When using object_store, we've occasionally hit errors that point to this hyper error:

error writing a body to connection: Broken pipe (os error 32)

We would like to retry this specific error as it seems like something that should be retryable in our use case, but BodyWrite (and Body I suppose) both don't seem to expose any public functions to determine this at a glance.

Describe the solution you'd like

Add a is_body_write() (and maybe a is_body for feature parity with reads) function.

Describe alternatives you've considered

The current workaround we're doing is checking the Display output and checking if it matches the error message associated with BodyWrite - this works but it feels like a terrible workaround and is outright pointed out in the docs to not depend on this behaviour.

Additional context

If there's a better method or a reason this error reason isn't exposed, please let me know!

@ClementTsang ClementTsang added the C-feature Category: feature. This is adding a new feature. label Mar 23, 2024
@seanmonstar
Copy link
Member

It's a fair thing to want! The most relevant idea is probably #2845.

Though I also suddenly am reminded of WriteException in Finagle...

@ClementTsang
Copy link
Author

👋 So just to be clear, would it make sense to (at least for now) expose is_body/is_body_write until #2845 has more progress made on it? I imagine the latter will take a while, and the former I can submit a PR pretty quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: feature. This is adding a new feature.
Projects
None yet
Development

No branches or pull requests

2 participants