thinking-sphinx: thinking-sphinx 4.2.0 is not generating any index

After upgrading the gem from the version 4.1.0 to 4.2.0 our server couldn’t do rake thinking_sphinx:rebuild.

Here you have the trace error:

Generating configuration to /home/machine/app/releases/20190314134324/config/production.sphinx.conf
[Thu Mar 14 15:04:15.016 2019] [ 3865] using config file '/home/machine/app/releases/20190314134324/config/production.sphinx.conf'...
[Thu Mar 14 15:04:15.017 2019] [ 3865] FATAL: no indexes found in '/home/machine/app/releases/20190314134324/config/production.sphinx.conf'
Sphinx 2.2.9-id64-release (rel22-r5006)
Copyright (c) 2001-2015, Andrew Aksyonoff
Copyright (c) 2008-2015, Sphinx Technologies Inc (http://sphinxsearch.com)


The Sphinx start command failed:
  Command: /usr/bin/searchd --pidfile --config "/home/machine/app/releases/20190314134324/config/production.sphinx.conf"
  Status:  1
  Output:  See above

There may be more information about the failure in /home/machine/app/shared/log/production.searchd.log.
rake stderr: Nothing written

We investigate and we found that this commit is the https://github.com/pat/thinking-sphinx/commit/6f65b7d08b29aa010ebfdf6280b262751dded3b1 one that breaks the ts:rebuild.

We fixed your issue by removing thous 3 lines.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 21 (12 by maintainers)

Most upvoted comments

FYI, just had that the same issue while trying to upgrade from 4.1 to 4.4. Turns out that, for some reason, I had in an Rails initializer ThinkingSphinx::Configuration.instance.preload_indices.

So:

  1. preload_indices was called a first time early from the initializer. That would trigger loading of app/indices/*.rb (by ActiveSupport::Dependencies.require_or_load file)
  2. ThinkingSphinx::Configuration.reset is now called (which wasn’t the case until https://github.com/pat/thinking-sphinx/commit/6f65b7d08b29aa010ebfdf6280b262751dded3b1, as noted by @WaKeMaTTa). @preloaded_indices is now nil
  3. preload_indices is called again as part of the usual init sequence, tries to require/load the indices again. ActiveSupport::Dependencies.require_or_load detects that the file is already required and do nothing. Index (re)definition is not performed.

Now I have to try to figure out why I had to preload indices early – they weren’t always properly initialized when I needed it a model.

Really appreciate you sharing that debugging @cmaion - it’s super-useful information.

I’d hope you don’t need the manual call in an initialiser any more 🤞 - certainly, if you find it’s still helpful, loop us in here.

Yup, figured that’d be the case, just wanted to confirm 👍 Though I did add bootsnap to my test app and ran the tasks in production on my own machine earlier, and I didn’t hit the problem 😐