Problem

When using drush solr-index to re-index a site, if the process takes longer than 15 minutes, the service will begin throwing 403s for every iteration of the indexing process.

To replicate

Run drush solr-index on a site with a large-enough number of nodes that indexing it would take longer than 15 minutes (e.g. 10,000 nodes).

Suggested approach

A quick skim of the code indicates that acquia_search_authenticator() uses REQUEST_TIME instead of time(). As a result, after the drush command has been running for over 15 minutes, the HMAC authenticator is no longer valid. This would be a likely place to start.

Comments

nick_vh’s picture

Confirming that this is an issue.

jrbeeman’s picture

The patch attached appears to have resolved the issue for me. Instead of using REQUEST_TIME, use time() when generating the authenticator string.

coltrane’s picture

I recommend an explicit comment for why time() is being used instead of REQUEST_TIME so it doesn't get changed back by future developer.

jrbeeman’s picture

Added a comment to explain why time() is being used.

nick_vh’s picture

*Agrees with coltrane*

Comment should be something like this :

"Due to the nature of drush and long running scripts it is required to refresh the timestamp value that is being sent. Acquia Search servers check for the timestamp and will discard requests if the timestamp that was sent is older or newer than 15 minutes."

We could get more complex also and refresh the value after 10 minutes but I suppose it is easier to just take the time() value.

nick_vh’s picture

Status: Active » Needs review

Let's test this, so we can get a green board and then get approval from coltrane to commit

nick_vh’s picture

Status: Needs review » Reviewed & tested by the community
cpliakas’s picture

Cross-posting to https://drupal.org/node/1678152. Although it an issue for a different module, the bug is the same and thought it would be appropriate to link them.

coltrane’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

janusman’s picture

Issue summary: View changes
Status: Closed (fixed) » Reviewed & tested by the community
StatusFileSize
new843 bytes

Yikes! The improvement was clobbered during a non-related commit :( We need to get it back in ASAP.

See: http://drupalcode.org/project/acquia_connector.git/blobdiff/9ff1452da650... for commit that undid the fix.

New patch from clean 7.x-2.x branch.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 11: acquia_search-solr-index-hmac-timeout-2077981-11.patch, failed testing.

nick_vh’s picture

Yikes indeed! That's not good

nick_vh’s picture

StatusFileSize
new2.83 KB
nick_vh’s picture

Status: Needs work » Needs review

  • Commit 8b9d40f on 7.x-2.x authored by Nick_vh, committed by coltrane:
    Issue #2077981 by Nick_vh, janusman: Long-running drush solr-index...
coltrane’s picture

Status: Needs review » Fixed

I've pushed this http://drupalcode.org/project/acquia_connector.git/commit/8b9d40f. Thanks very much for the speedy issue and patch and I'm sorry this happened and went so unnoticed!

Status: Fixed » Closed (fixed)

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