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

[sphinx] Ensures ThinkingSphinx preloads the all the indices upfront #2017

Merged
merged 1 commit into from Jul 2, 2020

Conversation

guicassolato
Copy link
Contributor

Otherwise concurrent threads (e.g. sidekiq, puma) can deadlock while racing to obtain access to the mutex block at
https://github.com/pat/thinking-sphinx/blob/2ae0c98b8b08242eb623e8eb5e364c4ed0fd3fcb/lib/thinking_sphinx/configuration.rb#L78-L91

This is known bug of ThinkingSphinx, fixed in v4.3.0+.

See

@guicassolato guicassolato self-assigned this Jul 1, 2020
Martouta
Martouta previously approved these changes Jul 1, 2020
hallelujah
hallelujah previously approved these changes Jul 2, 2020
Otherwise concurrent threads (e.g. sidekiq, puma) can deadlock while
racing to obtain access to the mutex block at
https://github.com/pat/thinking-sphinx/blob/v3.4.2/lib/thinking_sphinx/configuration.rb#L78.

This bug was fixed in ThinkingSphinx v4.3.0+.

See
- pat/thinking-sphinx#1051
- pat/thinking-sphinx#1132
# Prevents concurrent threads (e.g. sidekiq, puma) to deadlock while racing to obtain access to the mutex block at https://github.com/pat/thinking-sphinx/blob/v3.4.2/lib/thinking_sphinx/configuration.rb#L78
# This is a ThinkingSphinx's known bug, fixed in v4.3.0+ - see: https://github.com/pat/thinking-sphinx/commit/814beb0aa3d9dd1227c0f41d630888a738f7c0d6
# See also https://github.com/pat/thinking-sphinx/issues/1051 and https://github.com/pat/thinking-sphinx/issues/1132
ThinkingSphinx::Configuration.instance.preload_indices if Rails.env.development?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It turns out preloading in production and test envs was not as harmless as I thought it would be:
https://app.circleci.com/pipelines/github/3scale/porta/12581/workflows/1082990c-d295-4d66-83f9-0fac30692c8b

Doing it for development env only.

@guicassolato guicassolato merged commit 26e6aa1 into master Jul 2, 2020
@guicassolato guicassolato deleted the fix/sphinx-preload-indices branch July 2, 2020 14:53
@guicassolato guicassolato mentioned this pull request Jul 17, 2020
42 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants