Spree - Timeout when trying to access backend - ruby-on-rails

Since this afternoon, access to the backend of my spree shop is suddenly unavailable. When I try to visit any page in the backend (/admin/users, /admin/orders, etc) the page just loads for a long time, until it times out and I get the generic error page.
When I look into the logs I always see either :
Processing by Spree::Admin::OrdersController#index as HTML
Completed 500 Internal Server Error in 127259ms
** [Airbrake] Success: Net::HTTPOK
Errno::ETIMEDOUT (Connection timed out - connect(2)):
app/middleware/flash_session_cookie_middleware.rb:18:in `call'
or
Processing by Spree::Admin::OrdersController#index as HTML
Completed 500 Internal Server Error in 127520ms
** [Airbrake] Success: Net::HTTPOK
SocketError (getaddrinfo: Name or service not known):
app/middleware/flash_session_cookie_middleware.rb:17:in `call'
This started happening after the last deployment to production, which only changed images and stylesheets. I can't reproduce the error locally, despite having the same code and an exact copy of the production database.
I'm using Spree version 2.0.3

Run Spree::Config[:check_for_spree_alerts] = false in your console to fix this. You may also want to add this line to your initializers/spree.rb to ensure check_for_spree_alerts is not re-enabled in the future.
This is happening because the Spree Alerts website has been discontinued. See: https://github.com/spree/spree/pull/6516
To be specific, this is happening because when logging into the backend, Spree 2.0.x checks for any alerts from the Spree website here https://github.com/spree/spree/blob/2-0-stable/backend/app/controllers/spree/admin/base_controller.rb#L39 which then calls alert.rb:14 :
HTTParty.get('http://alerts.spreecommerce.com/alerts.json', query: params).parsed_response
At the moment, alerts.spreecommerce.com has been discontinued and is timing out, which explains the errors you're receiving.
The Spree Alerts code has been removed as of Spree 2.3, so you could also upgrade to that version to resolve this issue.

Related

Error 500 when running Rails in Google App Engine

I'm trying to run my application in google app engine, I get up normally and even works the endpoint, but when several requests the same, give 500 error, with the message:
Internal Server Error
uninitialized constant Concurrent :: Promises
I have nothing that uses this in my application.
Thanks for your help.
This is an already closed issue on google-cloud-ruby. You may need to update your gem by running:
$ gem update google-cloud-ruby

Heroku add-ons 'Logentries' & 'FlyData' query

I have a Ruby on Rails web app hosted on Heroku and I've setup Logentries add-on which sets up alarms for 'High Response Time'.
Lately, I have started getting emails for 'ALERT High Response Time', which mention that the high response time was triggered for
heroku router - - at=info method=GET path="/robots.txt"
Now, I know that Search Engines like Google, Microsoft use the robots.txt to ignore the pages that should not be indexed. Is there any other reason, why this file would be accessed?
Please correct me if I am missing something here.
Oh, and I am using the free version of Heroku i.e. 1 worker for website-content and I have 1 worker which runs periodic jobs using the Scheduler.
Query #2-
What's wrong with my application, when I get the following email from Logentries, with subject - 'ALERT Exit Timeout'
Exit timeout: Heroku/my-app
2014-10-13 18:53:56.351
188 <45>1 2014-10-13T18:53:56.053533+00:00 heroku web.1 - - Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM
Query #3-
I also installed the FlyData add-on trial to see how it works. I get emails with the subject - '[FlyData-Alert] (myapp) Application Error notification'.
The email says-
We noticed the following error logs on your application (myapp) :
2014-10-08T23:59:53.042662+00:00 app[scheduler.3266]: ** [NewRelic][10/08/14 23:59:53 +0000 21fd815f-5e08-42ab-80d8-4771ea1593c7 (2)] INFO : Installing Rails3 Error instrumentation
I think this email is triggered because of the INFO message from New Relic, which says - Installing Rails3 Error instrumentation. The FlyData add-on probably looks at the keyword 'Error' and triggers the email alert.
For Query #2: Heroku - Exit timeout: Heroku/my-app
According to Heroku's documentation,
"A process failed to exit within 10 seconds of being sent a SIGTERM indicating that it should stop. The process is sent SIGKILL to force an exit."
There is a complete list of Heroku Errors codes, including this one, that can be found here: https://devcenter.heroku.com/articles/error-codes#r12-exit-timeout
If you're using webrick to run your application on Heroku, you should try to switch to using 'thin' to see if that helps: See https://devcenter.heroku.com/articles/rails3#webserver.
or see the previous answer on stackoverflow here:
Rails app hosted on heroku: Error R12 (Exit timeout)
Hope this helps.
Michael

Capybara-Webkit "Unable to load URL"

I've been struggling with this issue for a few days and can't figure out what's causing the problem. The test suite runs fine on TravisCI, and locally when I restart my computer. After doing something locally though, I keep getting the same error message:
Unable to load URL: http://localhost.dev:3001/en/users/sign_in because of error loading http://localhost.dev:3001/en/users/sign_in: Unknown error (Capybara::Webkit::InvalidResponseError)
Here is the full webkit-debug trace:
Using the default profile...
..........Finished "EnableLogging" with response "Success()"
Wrote response true ""
Received "Visit"
Started "Visit"
Load started
"Visit" started page load
Started request to "http://localhost.dev:3001/en/users/sign_in"
Finished "Visit" with response "Success()"
Received 0 from "http://localhost.dev:3001/en/users/sign_in"
Page finished with false
Load finished
Page load from command finished
Wrote response false "{"class":"InvalidResponseError","message":"Unable to load URL: http://localhost.dev:3001/en/users/sign_in because of error loading http://localhost.dev:3001/en/users/sign_in: Unknown error"}"
F-Received "Reset"
Started "Reset"
undefined|0|SECURITY_ERR: DOM Exception 18: An attempt was made to break through the security policy of the user agent.
Finished "Reset" with response "Success()"
Wrote response true ""
Received "FindXpath"
Started "FindXpath"
Finished "FindXpath" with response "Success()"
Wrote response true ""
..........F--------
(::) failed steps (::)
Unable to load URL: http://localhost.dev:3001/en/users/sign_in because of error loading http://localhost.dev:3001/en/users/sign_in: Unknown error (Capybara::Webkit::InvalidResponseError)
This comes up anywhere in the app that I try to visit a path. From what I understand, the "Unknown error" is from qt, not capybara-webkit, but I'm not quite sure who would be best to ask. I am using DNSmasq for subdomains and we have multiple languages so localhost:3000 is redirected to www.localhost.dev:3000/en.
Current versions of things:
capybara 2.4.1
capybara-webkit 1.1.0
cucumber 1.3.14
cucumber-rails 1.4.0
pg 0.7.1
rails 4.0.0
ruby 2.1.2
dnsmasq 2.71
postgresql 9.3.5
qt 4.8.6 OSX - Mavericks 10.9.4
Edit 1: Also posted on the capybara-webkit repo: https://github.com/thoughtbot/capybara-webkit/issues/667
Edit 2: Here is the test log file: https://gist.github.com/GolfyMcG/060053eba51a9ba69722
As I posted in the related Github issue, I found the solution here:
https://apple.stackexchange.com/questions/26616/dns-not-resolving-on-mac-os
Had nothing to do with Capybara-webkit and everything to do with how I had my ElasticSearch instance spinning up with testing.

Passenger fails to send whole request to RoR

Recently, we are facing a strange problem where some XHR requests, sent from Passenger to our application server, fail to execute properly.
Please have look at following chain of events:
LB Passenger sends a request to the application server.
Rails returns a NoMethodError exception when trying to figure out which controller action this request is supposed to be processed by.
Rails error log:
Started POST "/user/" for 194.29.65.21 at 2013-03-25 13:14:38 +0100
NoMethodError (undefined method `[]' for nil:NilClass):
Here is a log when Rails is able to figure out which controller/action a request should be routed to:
Started POST "/User/" for 194.29.65.21 at 2013-03-25 13:14:38 +0100
Processing by Web::UserController#index as
Parameters: {"c"=>"1", "fref"=>""}
This error gets propagated to the application server passenger which throws the following error:
[ pid=20071 thr=3074915216 file=ext/nginx/HelperAgent.cpp:577
time=2013-03-24 22:25:58.257 ]: Uncaught exception in PassengerServer
client thread: exception: Cannot read response from backend
process: Connection reset by peer (104) backtrace:
in 'void Client::forwardResponse(Passenger::SessionPtr&, Passenger::FileDescriptor&)' (HelperAgent.cpp:361)
in 'void Client::handleRequest(Passenger::FileDescriptor&)' (HelperAgent.cpp:503)
in 'void Client::threadMain()' (HelperAgent.cpp:596)
And finally LB Nginx gives this error: up stream status = 500 error.
This error comes randomly for a given route. Even the frequency of occurrence of this error changes randomly.
System details:
Ruby: 1.9.2p180
Rails : 3.0.5
Phusion Passenger version 3.0.5
nginx version: n
We think this happens because Passenger is failing to send the whole request data to Rails which results in Rails failing to decide the valid controller action.
Review passenger config for nginx, I have experienced a lot issues with passenger for nginx.
http://www.modrails.com/documentation/Users%20guide%20Nginx.html#PassengerSpawnMethod specially verify this configuration and and add this in nginx.conf in parent node.
We just debugged and found that issue is not with XHR but with POST requests.
Also right now we are using passenger 3.0.5, does any know if upgrading to passenger 3.0.19 help?

Spree error 500

Need some help here.
I have deployed spree (0.70.3) on slicehost (ubuntu, ruby1.8.7, Rails
3.1.3), installed the spree gem, loaded in the sample data
successfully following the steps on spree startup manual and I am
using passenger (it works on localhost:3000). When I upload to my
server, however, instead of seeing the spree interface, I am getting
an error message. From the production.log:
Processing by HomeController#index as HTML Completed 500 Internal
Server Error in 22ms ActiveRecord::StatementInvalid (Could not find
table 'product_groups'):
Any suggestions how I can get this to work?
Website: http://www.nutxboutique.com
production.log is the rails log. It appears your problem is occurring before rails completes loading. If you're using apache, check/post the apache logs, it might have more clues as to what's going on.

Resources