meilisearch / meilisearch-rails

Meilisearch integration for Ruby on Rails
https://www.meilisearch.com
MIT License
295 stars 48 forks source link

MeiliSearch::CommunicationError: An error occurred while trying to connect to the MeiliSearch instance #365

Open drale2k opened 2 months ago

drale2k commented 2 months ago

Description I started to get the following error regularly when performing a search

MeiliSearch::CommunicationError: An error occurred while trying to connect to the MeiliSearch instance: failed to connect: getaddrinfo: nodename nor servname provided, or not known

The code is a simple search request:

Episode.search(formatted_keyword, filter: [ "transcribed_at > #{start_from_date.to_i}" ])

This code is running in a background job every 10 minutes, through a cron job setup with good_job. When it happens, which is irregular, it seems to happen a couple of times before it stops throwing an error and starts working again.

It definitely seems to be related to the timeout issue reported previously https://github.com/meilisearch/meilisearch-rails/issues/355 as it also throws the same error before causing the error above. See the attached screenshot

Screenshot 2024-06-19 at 18 54 59

The Episode index is very small, about 150 entries with relatively little data.

Screenshots or Logs If applicable, add screenshots or logs to help explain your problem.

Environment (please complete the following information):

ellnix commented 1 month ago

It looks like it might be a problem with the connection logic, probably specific to background jobs. It looks like you can stop using that httprb branch and switch to main. I'll see if I can reproduce it.

drale2k commented 1 month ago

I am using the httprb branch mainly because of https://github.com/meilisearch/meilisearch-rails/issues/355

Is it no longer needed for the other issue as well?

ellnix commented 1 month ago

I am using the httprb branch mainly because of #355

Is it no longer needed for the other issue as well?

It looks like the httprb change failed to fix it, so now I'm thinking it might be related to this issue.