Admin section timeout issue (September 2015)


The Australian production server was experiencing timeouts for all requests to any admin page, beginning sometime around 2015-09-10 00:00 UTC. Nothing we did seemed to fix the issue, whether reverting the codebase or restarting the server.


@RohanM narrowed the problem down to the requests that are made to a Spree web service which communicates information like security notices and notifications of urgent updates. These requests appear to have been timing out, which in turn was causing our server to kill the original requests from the client.


By turning off requests to the Spree web service, we managed to get our system functioning as normal. We are still investigating whether this service is temporarily or permanently offline. Requests to Spree can be turned off by setting Spree::Config[:check_for_spree_alerts] = false in the rails console, and then restarting your server. Apparently there is some magic which recognises assignment of spree config variables and writes them directly to the database.

@lawrence @MyriamBoure @gnollet @MikeiLL @pmackay

Noted thanks @Kirsten

Am I understanding correctly that the process would be:

  1. Stop rail server with Ctrl-C
  2. Open Rails Console in another terminal with bundle exec rails console
  3. Enter in rails console: irb(main):001:0> Spree::Config[:check_for_spree_alerts] = false
    Output is something like
  Spree::Preference Load (0.5ms)  SELECT "spree_preferences".* FROM "spree_preferences" WHERE "spree_preferences"."key" = 'spree/app_configuration/check_for_spree_alerts' LIMIT 1
   (0.1ms)  BEGIN
  SQL (4.3ms)  INSERT INTO "spree_preferences" ("created_at", "key", "updated_at", "value", "value_type") VALUES ($1, $2, $3, $4, $5) RETURNING "id"  [["created_at", Wed, 23 Sep 2015 23:21:34 CDT -05:00], ["key", "spree/app_configuration/check_for_spree_alerts"], ["updated_at", Wed, 23 Sep 2015 23:21:34 CDT -05:00], ["value", false], ["value_type", :boolean]]
   (0.3ms)  COMMIT
=> false

  1. Restart server in other terminal: bundle exec rails server [-b]

I’m getting same 500 error as shown on other thread:

   (0.5ms)  SELECT COUNT(*) FROM "spree_states" WHERE "spree_states"."country_id" = 49 AND (name = 'Alabama' OR abbr = 'Alabama')
  Spree::State Load (0.4ms)  SELECT "spree_states".* FROM "spree_states" WHERE "spree_states"."country_id" = 49 AND (name = 'Alabama' OR abbr = 'Alabama') ORDER BY name ASC LIMIT 1
   (0.2ms)  SELECT COUNT(*) FROM "enterprises" WHERE "enterprises"."name" = ''
  CACHE (0.0ms)  SELECT "spree_countries".* FROM "spree_countries" WHERE "spree_countries"."id" = 49 LIMIT 1
  CACHE (0.0ms)  SELECT COUNT(*) FROM "spree_states" WHERE "spree_states"."country_id" = 49 AND (name = 'Alabama' OR abbr = 'Alabama')
  CACHE (0.0ms)  SELECT "spree_states".* FROM "spree_states" WHERE "spree_states"."country_id" = 49 AND (name = 'Alabama' OR abbr = 'Alabama') ORDER BY name ASC LIMIT 1
  Enterprise Exists (0.3ms)  SELECT 1 AS one FROM "enterprises" WHERE "enterprises"."permalink" = 'my-enterprise' LIMIT 1
   (0.1ms)  ROLLBACK
Completed 500 Internal Server Error in 213.4ms
** [Bugsnag] No API key configured, couldn't notify

I know we are looking to configure Bugsnag to track down error source.