Although related to #1778072: Acquia Search credentials are lost when the site fails to connect to rpc.acquia.com, the root cause is slightly different and it is more critical in nature since the environment and environment settings are completely wiped out whenever rpc.acquia.com cannot be reached. Marking as critical because not only does this break search until the next cron run, but if your index set to "read only", it will come back up with read/write access since that is the default setting. Obviously this can potentially cause index corruption.

In order to replicate this bug, take the following steps:

  • Connect to Acquia Search using the standard install process, verify that it works
  • Change the "acquia_network_address" variable to something bogus, i.e. "https://example.com".
  • Run cron. Your environment and credentials are now deleted.

There is a corresponding bug posted against Apache Solr Search Integration that, under certain circumstances, will whitescreen your site when this condition occurs. See #1778150: Fatal error on all admin/config/* pages caused by SQL error in apachesolr_environment_load_subrecords() for more info.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cpliakas’s picture

Status: Active » Needs review
FileSize
669 bytes

The attached patch is a hotfix that only deletes your environment when the subscription is not found or expired. I'm not sure it is the best long term solution, but it more or less stops the bleeding immediately.

cpliakas’s picture

Same patch with a better comment.

coltrane’s picture

I can confirm the issue and patch in #2 fixes the read-only problem and doesn't delete the environment. However, I just want to confirm that it's OK that search isn't available during this time. A search fails with "The Apache Solr search engine is not available."

Also, patch in #2 calls acquia_agent_get_subscription() which is first invoked in acquia_agent_check_subscription() during the cron call, so this can result in an extra HTTP request just to get the subscription integer. Instead lets pass that int onto the acquia_subscription_status hook like the attached patch.

Chris, I assume this is also a problem in Drupal 6?

cpliakas’s picture

Thanks for reviewing! Yes, the server being unavailable is OK, but my testing has shown that it isn't given that search has the appropriate credentials stored from previos interactions with rpc.acquia.com. If that is not happening then it is an issue, but to me it is a follow-up issue that we can work though later.

Re: Drupal 6, it is a problem, but a slightly different one. If the same code exists then I believe this fix can be backported, although I haven't tested that yet.

Also, removing the extra http request is a good thing, great catch.

Going through one final test right now, will post back soon.

Thanks,
Chris

cpliakas’s picture

Status: Needs review » Reviewed & tested by the community

Tested out the patch, and it works exactly as you described. Unfortunately I was wrong in that search is still unavailable during this time as you said, but at least the environment is not deleted so that it can come back up automatically on the next successful cron run.

Marking as RTBC since it is the most critical to get the deleting get resolved, but I will post a separate issue where we can iterate over search being unavailable after rpc.acquia.com cannot be connected to. The problem is that the _acquia_search_derived_key() function required the subscription data to generate the derived key. Because the subscription data is not available the derived key cannot be calculated and the search request fails. Anyways, that is a trickier issue which will require some thought in order to resolve.

Thanks,
Chris

coltrane’s picture

Status: Reviewed & tested by the community » Patch (to be ported)
coltrane’s picture

Version: 7.x-2.x-dev » 6.x-2.x-dev

And need fix for Drupal 6

coltrane’s picture

Status: Patch (to be ported) » Needs review
FileSize
507 bytes

Patch for Drupal 6 version is minor since acquia_search is separate.

cpliakas’s picture

Nick_vh’s picture

Status: Needs review » Needs work

Just for a future note : This issue should be split in two for D6 - so a backport to 6.x-3.x can happen

Nick_vh’s picture

Nick_vh’s picture

And I don't think Acquia Search 6.x-1.x needs any update since it does not invoke that hook.

Nick_vh’s picture

Status: Needs work » Needs review
Nick_vh’s picture

Committed to 6.x-2.x so #1784770: acquia_search_enable_acquia_solr_environment() called multiple times during cron runs and when module is installed is unblocked.

If someone can close this after confirming this does not need to be backported to any other version.

coltrane’s picture

Status: Needs review » Fixed

Correct, Acquia Search 6.x-1.x does not invoke the acquia_subscription_status hook.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.