Lost connection to MySQL server

Jay Sanders's Avatar

Jay Sanders

25 Aug, 2015 10:27 PM

We are having issues with our search engine. Whenever anyone attempts to search, the logs contain the following error: Lost connection to MySQL server at 'reading authorization packet', system error: 0 -- I have restarted the app and attempted to index the engine, but it does not bring the service online. Search is a crucial feature, what can we do to remedy this situation? Thanks in advance for your help.

  1. Support Staff 1 Posted by Pat Allan on 25 Aug, 2015 10:58 PM

    Pat Allan's Avatar

    Hi Jay

    Can you let me know what the name of your app is? Also, have you tried running heroku run bundle exec flying-sphinx start?

    Kind regards,


  2. 2 Posted by Jay Sanders on 25 Aug, 2015 11:00 PM

    Jay Sanders's Avatar

    The app is beautifulnow. Yes, that command brought it back online. Why would it have crashed? It seems to go down pretty regularly.

  3. Support Staff 3 Posted by Pat Allan on 25 Aug, 2015 11:11 PM

    Pat Allan's Avatar

    Good to know its up again, though certainly keen to stop this recurring downtime. So I can debug further, can you let me know which versions of thinking-sphinx and flying-sphinx you're using in your app?

  4. Support Staff 4 Posted by Pat Allan on 26 Aug, 2015 05:09 AM

    Pat Allan's Avatar

    Hi Jay

    Just further to this: it looks like you've got a scheduled job running a rebuild every day - rebuilds are only required when you change the structure of your Sphinx indices (new/different fields or attributes, new/removed indices). Think of it as somewhat equivalent to db:migrate.

    Each time you run that, Sphinx is stopped while the indexing takes place, and this is perhaps where the errors have been coming from over time? Today's instance, for some reason, the daemon didn't restart, hence the longer outage.

    It's far better to just run the index command instead of a rebuild - this will keep your indexed data up-to-date, and avoids stopping/starting the daemon.

    Kind regards,


Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac