Skip to content

Conversation

@brunoocasali
Copy link
Member

@brunoocasali brunoocasali commented Mar 31, 2022

Pull Request

This PR fixes a bad DX when comes to errors, if a user tries to upload a big dataset, they will face some errors, one of them was related to the Errno::EPIPE error, which is really hard to figure out.

The idea of this PR is to handle the errors and improve the user experience.

What does this PR do?

Fixes #305

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

- Errno::EPIPE => MeiliSearch::CommunicationError
- Net::ReadTimeout, Net::OpenTimeout => MeiliSearch::TimeoutError
@brunoocasali
Copy link
Member Author

brunoocasali commented Mar 31, 2022

The overall gain with this PR is just one "no more Errno::EPIPE" error, but they intrinsically are still happening.

If send_request receives a broken pipe error it will rescue to a MeiliSearch::CommunicationError with this message:

MeiliSearch::CommunicationError: An error occurred while trying to connect to the MeiliSearch instance: Broken pipe.

Unfortunately, there is no way to have a specific error message because the broken pipe could happen for any other POST request, which means, the rescue Errno::EPIPE handler will match all the situations without knowing them.

The only way I see now, to fix it is replacing the httparty with another library that takes care of these errors like http.rb. Which I think is not the greatest idea because it would imply a lot of work to do. Maybe in the future :)

FYI: @curquiza

@brunoocasali brunoocasali requested a review from curquiza March 31, 2022 22:06
@brunoocasali brunoocasali marked this pull request as ready for review March 31, 2022 22:06
@brunoocasali brunoocasali added bug Something isn't working help wanted Extra attention is needed labels Apr 7, 2022
@curquiza
Copy link
Member

curquiza commented Apr 7, 2022

Thanks for the explanations Bruno, and the investigation!

The only way I see now, to fix it is replacing the httparty with another library that takes care of these errors like http.rb. Which I think is not the greatest idea because it would imply a lot of work to do. Maybe in the future :)

I totally agree 😄

Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

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

🤘

@brunoocasali brunoocasali removed the help wanted Extra attention is needed label Apr 7, 2022
@brunoocasali
Copy link
Member Author

bors merge

@meili-bors
Copy link
Contributor

meili-bors bot commented Apr 7, 2022

@meili-bors meili-bors bot merged commit 8d5caef into main Apr 7, 2022
@meili-bors meili-bors bot deleted the fix-connection-errors branch April 7, 2022 20:08
meili-bors bot added a commit that referenced this pull request May 9, 2022
323: Update version for the next release (v0.18.3) r=curquiza a=brunoocasali

This version makes this package compatible with Meilisearch v0.27.0 🎉
Check out the changelog of [Meilisearch v0.27.0](https://github.com/meilisearch/meilisearch/releases/tag/v0.27.0) for more information on the changes.

## 🚀 Enhancements

* Ensure nested field support (#318) `@brunoocasali`
* Add `highlightPreTag`, `highlightPostTag`, `cropMarker`, parameters in the search request (#319) `@brunoocasali`
* Create a helper module to reduce test duplication (#316) `@brunoocasali`

## 🐛 Bug Fixes

* Improve error handling, rescue EPIPE and Net::* errors (#307) `@brunoocasali`

Thanks again to `@brunoocasali!` 🎉


Co-authored-by: Bruno Casali <brunoocasali@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broken pipe error

3 participants