Rails Admin POST requests cause H15 error on Heroku - heroku

I have a rails app that is working fine on Heroku, but all the POST requests coming from Rails admin are hanging for 55 seconds before causing a H15 "Idle Connection" error.
I've read that it can come from:
ActionCable not pinging the server during 55 consecutive seconds but I'm not using real time features with Rails Admin and I removed my ActionCable code to test and the problem still occurs
The server tries to return a response to a different IP than the one that initiated the call once you've configured your DNS, but I'm not, I'm not using a custom domain name, I use the my website-herokuapp.com one.
Here's the log of a POST request from my app from the admin:
2021-01-24T19:09:36.245896+00:00 app[web.1]: I, [2021-01-24T19:09:36.245747 #4] INFO -- : source=rack-timeout id=21d5a60a-a82a-4cf7-bbe1-b0254f5823c7 wait=11ms timeout=15000ms state=ready
2021-01-24T19:09:36.246186+00:00 app[web.1]: D, [2021-01-24T19:09:36.246074 #4] DEBUG -- : source=rack-timeout id=21d5a60a-a82a-4cf7-bbe1-b0254f5823c7 wait=11ms timeout=15000ms service=0ms state=active
2021-01-24T19:09:36.246456+00:00 app[web.1]: I, [2021-01-24T19:09:36.246394 #4] INFO -- : [21d5a60a-a82a-4cf7-bbe1-b0254f5823c7] Started PUT "/admin/first_job/252990/edit" for 92.183.112.168 at 2021-01-24 19:09:36 +0000
2021-01-24T19:09:36.248487+00:00 app[web.1]: I, [2021-01-24T19:09:36.248393 #4] INFO -- : [21d5a60a-a82a-4cf7-bbe1-b0254f5823c7] Processing by RailsAdmin::MainController#edit as HTML
2021-01-24T19:09:36.248636+00:00 app[web.1]: I, [2021-01-24T19:09:36.248524 #4] INFO -- : [21d5a60a-a82a-4cf7-bbe1-b0254f5823c7] Parameters: {"utf8"=>"✓", "authenticity_token"=>"9QGOhotnG3BkLq6TbkXuXZgMVxJ+AinueV0oEUaVw5iaQ6DRJukISaCV4x+lcpXog9ExNYf9DB8/u/jufN6+Dg==", "first_job"=>{"company_name"=>"My company"}, "return_to"=>"https://mywebsite-staging.herokuapp.com/admin/first_job", "_save"=>"", "model_name"=>"first_job", "id"=>"252990"}
2021-01-24T19:09:36.285663+00:00 app[web.1]: D, [2021-01-24T19:09:36.285530 #4] DEBUG -- : [21d5a60a-a82a-4cf7-bbe1-b0254f5823c7] User Load (1.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 307509], ["LIMIT", 1]]
2021-01-24T19:09:36.307192+00:00 app[web.1]: D, [2021-01-24T19:09:36.307039 #4] DEBUG -- : [21d5a60a-a82a-4cf7-bbe1-b0254f5823c7] FirstJob Load (2.0ms) SELECT "first_jobs".* FROM "first_jobs" WHERE "first_jobs"."id" = $1 ORDER BY "first_jobs"."id" ASC LIMIT $2 [["id", 252990], ["LIMIT", 1]]
2021-01-24T19:09:36.312261+00:00 app[web.1]: D, [2021-01-24T19:09:36.312087 #4] DEBUG -- : [21d5a60a-a82a-4cf7-bbe1-b0254f5823c7] (1.0ms) BEGIN
2021-01-24T19:09:36.317945+00:00 app[web.1]: D, [2021-01-24T19:09:36.317805 #4] DEBUG -- : [21d5a60a-a82a-4cf7-bbe1-b0254f5823c7] Company Load (1.8ms) SELECT "companies".* FROM "companies" WHERE "companies"."id" = $1 LIMIT $2 [["id", 26218], ["LIMIT", 1]]
2021-01-24T19:09:36.322239+00:00 app[web.1]: D, [2021-01-24T19:09:36.322101 #4] DEBUG -- : [21d5a60a-a82a-4cf7-bbe1-b0254f5823c7] (1.1ms) COMMIT
2021-01-24T19:09:36.323441+00:00 app[web.1]: I, [2021-01-24T19:09:36.323351 #4] INFO -- : [21d5a60a-a82a-4cf7-bbe1-b0254f5823c7] Redirected to https://mywebsite-staging.herokuapp.com/admin/first_job
2021-01-24T19:09:36.324756+00:00 app[web.1]: I, [2021-01-24T19:09:36.324674 #4] INFO -- : Completed 302 Found in 76ms (ActiveRecord: 19.6ms)
2021-01-24T19:09:36.324858+00:00 app[web.1]: I, [2021-01-24T19:09:36.324425 #4] INFO -- : source=rack-timeout id=21d5a60a-a82a-4cf7-bbe1-b0254f5823c7 wait=11ms timeout=15000ms service=79ms state=completed
2021-01-24T19:10:31.518929+00:00 heroku[router]: at=error code=H15 desc="Idle connection" method=POST path="/admin/first_job/252990/edit" host=mywebsite-staging.herokuapp.com request_id=21d5a60a-a82a-4cf7-bbe1-b0254f5823c7 fwd="92.183.112.168" dyno=web.1 connect=0ms service=55282ms status=503 bytes= protocol=https
Oh and of course, everything is working fine on my local.
Do someone has an idea?

Related

Ruby/Heroku app errors "We're sorry, but something went wrong" troubleshooting

I am trying to setup an Elo rating system for my local 8 ball pool league using:
https://github.com/elovation/elovation
The only changes I have made to above repo prior to deployment are specifying heroku:stack-18 in app.json and running bundle install after specifying to use https:// instead of git://
I have deployed my app to Heroku without error but when loading my app I get a "We're sorry, something went wrong page"
After deployment I have ran heroku run rake db:migrate and heroku restart but my error persists
I have included below output of heroku logs ; any help with the below errors would be greatly appreciated as I am not particularly familiar with Ruby or Heroku postgres.
2022-06-21T12:54:08.886300+00:00 app[web.1]: I, [2022-06-21T12:54:08.886206 #9] INFO -- : [dc5be6b7-715a-47a0-8936-e0ba1c6b2c13] Processing by DashboardController#show as HTML
2022-06-21T12:54:08.888800+00:00 app[web.1]: D, [2022-06-21T12:54:08.888726 #9] DEBUG -- : [dc5be6b7-715a-47a0-8936-e0ba1c6b2c13] Player Load (0.5ms) SELECT "players".* FROM "players"
2022-06-21T12:54:08.889854+00:00 app[web.1]: I, [2022-06-21T12:54:08.889789 #9] INFO -- : [dc5be6b7-715a-47a0-8936-e0ba1c6b2c13] Rendering dashboard/show.html.erb within layouts/application
2022-06-21T12:54:08.891005+00:00 app[web.1]: D, [2022-06-21T12:54:08.890942 #9] DEBUG -- : [dc5be6b7-715a-47a0-8936-e0ba1c6b2c13] Game Load (0.5ms) SELECT "games".* FROM "games" ORDER BY updated_at DESC
2022-06-21T12:54:08.891468+00:00 app[web.1]: I, [2022-06-21T12:54:08.891374 #9] INFO -- : [dc5be6b7-715a-47a0-8936-e0ba1c6b2c13] Rendered dashboard/show.html.erb within layouts/application (1.5ms)
2022-06-21T12:54:08.893279+00:00 app[web.1]: I, [2022-06-21T12:54:08.893225 #9] INFO -- : [dc5be6b7-715a-47a0-8936-e0ba1c6b2c13] Completed 500 Internal Server Error in 7ms (ActiveRecord: 1.1ms)
2022-06-21T12:54:08.894220+00:00 app[web.1]: F, [2022-06-21T12:54:08.894169 #9] FATAL -- : [dc5be6b7-715a-47a0-8936-e0ba1c6b2c13]
2022-06-21T12:54:08.894271+00:00 app[web.1]: F, [2022-06-21T12:54:08.894239 #9] FATAL -- : [dc5be6b7-715a-47a0-8936-e0ba1c6b2c13] ActionView::Template::Error (The asset "chartkick.js" is not present in the asset pipeline.
2022-06-21T12:54:08.894272+00:00 app[web.1]: ):
2022-06-21T12:54:08.894439+00:00 app[web.1]: F, [2022-06-21T12:54:08.894403 #9] FATAL -- : [dc5be6b7-715a-47a0-8936-e0ba1c6b2c13] 11: <%= csrf_meta_tags %>
2022-06-21T12:54:08.894440+00:00 app[web.1]: [dc5be6b7-715a-47a0-8936-e0ba1c6b2c13] 12: <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700' rel='stylesheet' type='text/css'>
2022-06-21T12:54:08.894441+00:00 app[web.1]: [dc5be6b7-715a-47a0-8936-e0ba1c6b2c13] 13:
2022-06-21T12:54:08.894441+00:00 app[web.1]: [dc5be6b7-715a-47a0-8936-e0ba1c6b2c13] 14: <%= javascript_include_tag "//www.google.com/jsapi", "chartkick" %>
2022-06-21T12:54:08.894442+00:00 app[web.1]: [dc5be6b7-715a-47a0-8936-e0ba1c6b2c13] 15: </head>
2022-06-21T12:54:08.894442+00:00 app[web.1]: [dc5be6b7-715a-47a0-8936-e0ba1c6b2c13] 16: <body>
2022-06-21T12:54:08.894443+00:00 app[web.1]: [dc5be6b7-715a-47a0-8936-e0ba1c6b2c13] 17: <div id='container'>
2022-06-21T12:54:08.894482+00:00 app[web.1]: F, [2022-06-21T12:54:08.894452 #9] FATAL -- : [dc5be6b7-715a-47a0-8936-e0ba1c6b2c13]
2022-06-21T12:54:08.894523+00:00 app[web.1]: F, [2022-06-21T12:54:08.894495 #9] FATAL -- : [dc5be6b7-715a-47a0-8936-e0ba1c6b2c13] app/views/layouts/application.html.erb:14:in `_app_views_layouts_application_html_erb___4496802780226790006_47054455194320'

xmpp4r throws exception on login: "Exception caught in Parser thread! (Jabber::ServerDisconnected)"

I tried to connect to my XMPP server using xmpp4r in ruby and my code is very simple, but I don't know why I got error.
I can successfully use ichat to log in using chat#localhost and also to the 5280/admin website.
require 'xmpp4r/client'
include Jabber
Jabber::debug = true
jid = Jabber::JID.new('chat#localhost')
client = Jabber::Client.new(jid)
client.connect
client.auth('123456')
client.close
And the error is:
D, [2013-02-18T03:24:55.768029 #15238] DEBUG -- : Debugging mode enabled.
W, [2013-02-18T03:24:55.768341 #15238] WARN -- : Warnings mode enabled.
D, [2013-02-18T03:24:55.772467 #15238] DEBUG -- : RESOLVING:
_xmpp-client._tcp.localhost (SRV)
D, [2013-02-18T03:24:55.778631 #15238] DEBUG -- : CONNECTING:
localhost:5222
D, [2013-02-18T03:24:55.780122 #15238] DEBUG -- : SENDING:
<stream:stream xmlns:stream='http://etherx.jabber.org/streams'
xmlns='jabber:client' to='localhost' xml:lang='en' version='1.0' >
D, [2013-02-18T03:24:55.782276 #15238] DEBUG -- : RECEIVED:
<stream:stream from='localhost' id='3021975152' xml:lang='en'
xmlns:stream='http://etherx.jabber.org/streams' version='1.0'
xmlns='jabber:client'/>
D, [2013-02-18T03:24:55.784022 #15238] DEBUG -- : RECEIVED:
<stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<mechanism>SCRAM-SHA-1</mechanism><mechanism>DIGEST-MD5</mechanism>
<mechanism>PLAIN</mechanism></mechanisms><c hash='sha-1'
node='http://www.process-one.net/en/ejabberd/'
ver='yy7di5kE0syuCXOQTXNBTclpNTo=' xmlns='http://jabber.org/protocol/caps'/>
<register xmlns='http://jabber.org/features/iq-register'/></stream:features>
D, [2013-02-18T03:24:55.784203 #15238] DEBUG -- : FEATURES: waiting...
D, [2013-02-18T03:24:55.784785 #15238] DEBUG -- : FEATURES: received
D, [2013-02-18T03:24:55.785290 #15238] DEBUG -- : PROCESSING:
<stream:features xmlns='jabber:client'><mechanisms
xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>SCRAM-SHA-1</mechanism>
<mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism></mechanisms><c
hash='sha-1' node='http://www.process-one.net/en/ejabberd/'
ver='yy7di5kE0syuCXOQTXNBTclpNTo=' xmlns='http://jabber.org/protocol/caps'/>
<register xmlns='http://jabber.org/features/iq-register'/></stream:features>
(REXML::Element)
D, [2013-02-18T03:24:55.785360 #15238] DEBUG -- : FEATURES: waiting finished
D, [2013-02-18T03:24:55.785450 #15238] DEBUG -- : TRYING stanzacbs...
D, [2013-02-18T03:24:55.785556 #15238] DEBUG -- : TRYING
message/iq/presence/cbs...
D, [2013-02-18T03:24:55.785987 #15238] DEBUG -- : SENDING:
<auth mechanism='DIGEST-MD5' xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
D, [2013-02-18T03:24:55.787784 #15238] DEBUG -- : RECEIVED:
<challenge xmlns='urn:ietf:params:xml:ns:xmppsasl'>bm9uY2U9IjE5NzEzNzk5NzQiLHFvcD0iYXV0aCIsY2hhcnNldD11dGYtOCxhbGdvcml0aG09bWQ1LXNlc3M=</challenge>
D, [2013-02-18T03:24:55.788143 #15238] DEBUG -- : SASL DIGEST-MD5 challenge:
nonce="1971379974",qop="auth",charset=utf-8,algorithm=md5-sess
{"nonce"=>"1971379974", "qop"=>"auth", "charset"=>"utf-8", "algorithm"=>"md5-sess"}
D, [2013-02-18T03:24:55.788475 #15238] DEBUG -- : SASL DIGEST-MD5 response:
nonce="1971379974",charset=utf-8,username="chat",realm="localhost",cnonce="92a37c018b9c32339c4b52ee0b02d67e",nc=00000001,qop=auth,digest-uri="xmpp/localhost",response=9c6bca9f4cf6f8daf3197a914023729a
{"nonce"=>"\"1971379974\"", "charset"=>"utf-8", "username"=>"\"chat\"", "realm"=>"\"localhost\"", "cnonce"=>"\"92a37c018b9c32339c4b52ee0b02d67e\"", "nc"=>"00000001", "qop"=>"auth", "digest-uri"=>"\"xmpp/localhost\"", "response"=>"9c6bca9f4cf6f8daf3197a914023729a"}
D, [2013-02-18T03:24:55.788761 #15238] DEBUG -- : SENDING:
<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>bm9uY2U9IjE5NzEzNzk5NzQiLGNoYXJzZXQ9dXRmLTgsdXNlcm5hbWU9ImNoYXQiLHJlYWxtPSJsb2NhbGhvc3QiLGNub25jZT0iOTJhMzdjMDE4YjljMzIzMzljNGI1MmVlMGIwMmQ2N2UiLG5jPTAwMDAwMD
AxLHFvcD1hdXRoLGRpZ2VzdC11cmk9InhtcHAvbG9jYWxob3N0IixyZXNwb25zZT05YzZiY2E5ZjRjZjZm
OGRhZjMxOTdhOTE0MDIzNzI5YQ==</response>
D, [2013-02-18T03:24:55.818548 #15238] DEBUG -- : RECEIVED:
<challenge xmlns='urn:ietf:params:xml:ns:xmpp-
sasl'>cnNwYXV0aD01NTQ2NTVlYjljYWUzZGExMjhmZjBkMWUzNDUzYmIwZQ==</challenge>
D, [2013-02-18T03:24:55.819064 #15238] DEBUG -- : SENDING:
<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
D, [2013-02-18T03:24:56.147820 #15238] DEBUG -- : RECEIVED:
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
D, [2013-02-18T03:24:56.148432 #15238] DEBUG -- : SENDING:
<stream:stream xmlns:stream='http://etherx.jabber.org/streams'
xmlns='jabber:client' to='localhost' xml:lang='en' version='1.0' >
D, [2013-02-18T03:25:56.151018 #15238] DEBUG -- : SENDING:
W, [2013-02-18T03:25:56.212617 #15238] WARN -- : EXCEPTION:
Jabber::ServerDisconnected
Server Disconnected!
/home/ubuntu/.rvm/gems/ruby-1.9.3-p385/gems/xmpp4r-
0.5/lib/xmpp4r/streamparser.rb:68:in `block in parse'
/home/ubuntu/.rvm/rubies/ruby-1.9.3-
p385/lib/ruby/1.9.1/rexml/parsers/sax2parser.rb:195:in `call'
/home/ubuntu/.rvm/rubies/ruby-1.9.3-
p385/lib/ruby/1.9.1/rexml/parsers/sax2parser.rb:195:in `block in handle'
/home/ubuntu/.rvm/rubies/ruby-1.9.3-
p385/lib/ruby/1.9.1/rexml/parsers/sax2parser.rb:195:in `each'
/home/ubuntu/.rvm/rubies/ruby-1.9.3-
p385/lib/ruby/1.9.1/rexml/parsers/sax2parser.rb:195:in `handle'
/home/ubuntu/.rvm/rubies/ruby-1.9.3-
p385/lib/ruby/1.9.1/rexml/parsers/sax2parser.rb:95:in `parse'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p385/gems/xmpp4r-
0.5/lib/xmpp4r/streamparser.rb:79:in `parse'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p385/gems/xmpp4r-
0.5/lib/xmpp4r/stream.rb:75:in `block in start'
W, [2013-02-18T03:25:56.212740 #15238] WARN -- : Exception caught in Parser
thread! (Jabber::ServerDisconnected)
/home/ubuntu/.rvm/gems/ruby-1.9.3-p385/gems/xmpp4r-
0.5/lib/xmpp4r/streamparser.rb:68:in `block in parse'
Any ideas?
Thanks!!
I also faced this issue when sending message over facebook using Jabber.
Even wrapped in a try/catch, sometimes, Jabber::ServerDisconnected thrown and caused web server stop.
In xmpp4r source code, they thrown Jabber::ServerDisconnected when received disconnected signal and Thread.abort_on_exception = true in each thread
Ref https://github.com/lnussbaum/xmpp4r/blob/master/lib/xmpp4r/streamparser.rb and https://github.com/lnussbaum/xmpp4r/blob/master/lib/xmpp4r/stream.rb
I guess exception thrown in an orphan thread.
I have no solution, but a workaround that set Thread::abort_on_exception = false globally (in class/method using Jabber). So exception still thrown, but we ignore it.
There is a better way of handling errors, as mentioned in the docs:
If you want your connection to survive disconnects and timeouts, catch exception in Stream#on_exception and re-call Client#connect and Client#auth. Don‘t forget to re-send initial Presence and everything else you need to setup your session.
Stream#on_exception link

ActiveRecord::StatementInvalid error

This question has been asked a lot, but still, nothing seems to be working. My application runs perfectly in testing, but when run on heroku, I get the error 500 saying "we're sorry , but something went wrong." I've checked the log files for the server, and my error seems to be here somewhere:
2012-10-21T15:29:40+00:00 app[web.1]:
2012-10-21T15:29:40+00:00 app[web.1]: Started GET "/" for 117.192.23.223 at 2012-10-21 15:29:40 +0000
2012-10-21T15:29:40+00:00 app[web.1]: cache: [GET /] miss
2012-10-21T15:29:40+00:00 app[web.1]:
2012-10-21T15:29:40+00:00 heroku[router]: GET whispering-coast-7415.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=5ms status=301 bytes=115
2012-10-21T15:29:40+00:00 app[web.1]:
2012-10-21T15:29:40+00:00 app[web.1]: Started GET "/movies" for 117.192.23.223 at 2012-10-21 15:29:40 +0000
2012-10-21T15:29:40+00:00 app[web.1]:
2012-10-21T15:29:40+00:00 app[web.1]: Processing by MoviesController#index as HTML
2012-10-21T15:29:40+00:00 app[web.1]: Completed 500 Internal Server Error in 2ms
2012-10-21T15:29:40+00:00 heroku[router]: GET whispering-coast-7415.herokuapp.com/movies dyno=web.1 queue=0 wait=0ms service=17ms status=500 bytes=728
2012-10-21T15:29:40+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR: column "movies.id" must appear in the GROUP BY clause or be used in an aggregate function
2012-10-21T15:29:40+00:00 app[web.1]: LINE 1: SELECT "movies".* FROM "movies" GROUP BY rating
2012-10-21T15:29:40+00:00 app[web.1]:
2012-10-21T15:29:40+00:00 app[web.1]: ^
2012-10-21T15:29:40+00:00 app[web.1]:
2012-10-21T15:29:40+00:00 app[web.1]: cache: [GET /movies] miss
2012-10-21T15:29:40+00:00 app[web.1]: : SELECT "movies".* FROM "mo
vies" GROUP BY rating):
2012-10-21T15:29:40+00:00 app[web.1]: app/controllers/movies_controller.rb:11:in `index'
2012-10-21T15:29:40+00:00 app[web.1]: app/models/movie.rb:4:in `get_ratings'
2012-10-21T15:29:40+00:00 app[web.1]:
2012-10-21T15:29:41+00:00 heroku[router]: GET whispering-coast-7415.herokuapp.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=8ms status=200 bytes=0
2012-10-21T15:29:41+00:00 app[web.1]: cache: [GET /favicon.ico] stale, invalid, store
PostgreSQL (on Heroku) requires you to GROUP BY all the columns in the SELECT list so in this case instead of:
SELECT "movies".* FROM "movies" GROUP BY rating
you might want to do something like:
SELECT rating FROM "movies" GROUP BY rating
or in Rails:
Movie.select(:rating).group(:rating)

Devise Login and Signup Custom Form on Heroku Not Behaving

So on my localhost, the custom devise forms work great! No issues whatsoever - when I log in from my custom form on a different page, it logs the user in and redirects to the homepage as expected.
However, when I deploy to Heroku, the app stops behaving - the custom form directs the user to the actual login page without logging them in.
This is the output on my Heroku Logs:
2012-10-18T09:08:08+00:00 app[web.1]: Started POST "/user/sign_in" for 116.15.222.245 at 2012-10-18 09:08:08 +0000
2012-10-18T09:08:08+00:00 app[web.1]: cache: [POST /user/sign_in] invalidate, pass
2012-10-18T09:08:08+00:00 app[web.1]: Processing by UserSessionsController#create as HTML
2012-10-18T09:08:08+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"4WDTRkX842UVz7nFuGbWbA3z47+rraKXQgl3PRYuWJY=", "user"=>{"email"=>"spree#example.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Log In"}
2012-10-18T09:08:08+00:00 app[web.1]: Redirected to https://example.com/user/sign_in
2012-10-18T09:08:08+00:00 app[web.1]: Completed 302 Found in 11ms
2012-10-18T09:08:08+00:00 heroku[router]: POST example.com/user/sign_in dyno=web.1 queue=0 wait=0ms service=16ms status=302 bytes=101
2012-10-18T09:08:08+00:00 heroku[nginx]: 108.162.225.233 - - [18/Oct/2012:09:08:08 +0000] "POST /user/sign_in HTTP/1.1" 302 101 "http://example.com/referral_login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20100101 Firefox/15.0.1" example.com
2012-10-18T09:08:10+00:00 app[web.1]:
2012-10-18T09:08:10+00:00 app[web.1]: Started GET "/user/sign_in" for 116.15.222.245 at 2012-10-18 09:08:10 +0000
2012-10-18T09:08:10+00:00 app[web.1]:
2012-10-18T09:08:10+00:00 heroku[router]: GET example.com/user/sign_in dyno=web.1 queue=0 wait=0ms service=16ms status=200 bytes=7835
2012-10-18T09:08:10+00:00 app[web.1]: cache: [GET /user/sign_in] miss
2012-10-18T09:08:10+00:00 app[web.1]: Processing by UserSessionsController#new as HTML
2012-10-18T09:08:10+00:00 app[web.1]: Rendered shared/_error_messages.html.erb (0.1ms)
2012-10-18T09:08:10+00:00 app[web.1]: Rendered shared/_login.html.erb (2.3ms)
2012-10-18T09:08:10+00:00 app[web.1]: Rendered user_sessions/new.html.erb within layouts/spree_application (3.0ms)
2012-10-18T09:08:10+00:00 app[web.1]: Rendered shared/_head.html.erb (1.0ms)
2012-10-18T09:08:10+00:00 app[web.1]: Rendered shared/_store_menu.html.erb (0.7ms)
2012-10-18T09:08:10+00:00 app[web.1]: Rendered shared/_top_menu_bar.html.erb (0.5ms)
2012-10-18T09:08:10+00:00 heroku[nginx]: 108.162.225.233 - - [18/Oct/2012:09:08:10 +0000] "GET /user/sign_in HTTP/1.1" 200 3412 "http://example.com/referral_login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20100101 Firefox/15.0.1" example.com
This is my output on my localhost:
Started POST "/user/sign_in" for 127.0.0.1 at 2012-10-18 17:21:36 +0800
Processing by UserSessionsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"m38Y47hk4UyGYAMnd76y5Qo2nK1Nv//v7s2+XdNHCbU=", "user"=>{"email"=>"spree#example.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Log In"}
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'spree#example.com' LIMIT 1
(23.6ms) SELECT COUNT(DISTINCT "users"."id") FROM "users" LEFT OUTER JOIN "roles_users" ON "roles_users"."user_id" = "users"."id" LEFT OUTER JOIN "roles" ON "roles"."id" = "roles_users"."role_id" WHERE "roles"."name" = 'admin'
(0.5ms) UPDATE "users" SET "last_sign_in_at" = '2012-10-18 05:56:54.897695', "current_sign_in_at" = '2012-10-18 09:21:39.033308', "sign_in_count" = 75, "updated_at" = '2012-10-18 09:21:39.081684' WHERE "users"."id" = 1
Redirected to http://localhost:3000/
Completed 302 Found in 227ms
Started GET "/" for 127.0.0.1 at 2012-10-18 17:21:39 +0800
Processing by LandingController#index as HTML
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Rendered landing/index.html.erb within layouts/spree_application (1.7ms)
Rendered shared/_head.html.erb (2.0ms)
Rendered shared/_store_menu.html.erb (2.6ms)
Rendered shared/_top_menu_bar.html.erb (1.7ms)
Tracker Load (0.3ms) SELECT "trackers".* FROM "trackers" WHERE "trackers"."active" = 't' AND "trackers"."environment" = 'development' LIMIT 1
Rendered shared/_google_analytics.html.erb (14.1ms)
Completed 200 OK in 183ms (Views: 148.1ms | ActiveRecord: 1.9ms)
Can anyone help to shed some light as to why this might be and how to go about resolving this? I looked through Devise wiki, did a bunch of Google searches and tried a few things without success. Would appreciate any help!
Spree defaults to require SSL in production environments, so if your POST request is not https, it'll redirect to the login page.

Request Timeout (H-12) on POST requests

We're facing an interesting problem on our staging server on Heroku. Each post/put/delete request freezes for about 10 secondes or more and some of them eventually time out resulting in a Heroku H-12 time out error.
Another interesting detail: the request seems to be processed after the time out because the database records get updated. We do not process a big data, we're just trying to update one field on one record in the DB.
Our local environment (localhost:3000) is working properly. We do not have any blocking action (sending email, processing big queries, ...)
We've tried activating/deactivating caching (dalli), asset compilation, we've switched the instance of our staging server. We've tried different settings in our staging.rb.
Any suggestions on how we could try to troubleshoot this?
2012-10-08T21:32:15+00:00 app[web.1]: Started PUT "/users/151" for 67.180.34.143 at 2012-10-08 21:32:15 +0000
2012-10-08T21:32:15+00:00 app[web.1]: Processing by UsersController#update as HTML
2012-10-08T21:32:15+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"n4xK0Esi2zgBqSRtDTu3IEhnUAv0//bAkjLnKyk7xFk=", "user"=>{"role"=>"2", "designer_status"=>"1", "invitation_limit"=>"56"}, "commit"=>"Update", "id"=>"151"}
2012-10-08T21:32:45+00:00 heroku[router]: Error H12 (Request timeout) -> POST ziba-exygy-2.herokuapp.com/users/151 dyno=web.1 queue= wait= service=30000ms status=503 bytes=0
2012-10-08T21:32:46+00:00 app[web.1]: Redirected to https://ziba-exygy-2.herokuapp.com/users
2012-10-08T21:32:46+00:00 app[web.1]: Completed 302 Found in 30304ms (ActiveRecord: 53.7ms)
2012-10-08T21:32:46+00:00 app[web.1]: cache: [POST /users/151] invalidate, pass
2012-10-08T21:32:46+00:00 app[web.1]: User Load (3.7ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 42 LIMIT 1
2012-10-08T21:32:46+00:00 app[web.1]: User Load (12.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 151 LIMIT 1
2012-10-08T21:32:46+00:00 app[web.1]: (2.8ms) BEGIN
2012-10-08T21:32:46+00:00 app[web.1]: User Exists (3.2ms) SELECT 1 FROM `users` WHERE (`users`.`email` = BINARY 'pierre+tttttttttt#blablabla.com' AND `users`.`id` != 151) LIMIT 1
2012-10-08T21:32:46+00:00 app[web.1]: (3.1ms) COMMIT
2012-10-08T21:32:46+00:00 app[web.1]: (2.7ms) BEGIN
2012-10-08T21:32:46+00:00 app[web.1]: CACHE (0.0ms) SELECT 1 FROM `users` WHERE (`users`.`email` = BINARY 'pierre+tttttttttt# blablabla.com' AND `users`.`id` != 151) LIMIT 1
2012-10-08T21:32:46+00:00 app[web.1]: (11.6ms) UPDATE `users` SET `invitation_limit` = 56, `updated_at` = '2012-10-08 21:32:31' WHERE `users`.`id` = 151
2012-10-08T21:32:46+00:00 app[web.1]: (2.9ms) COMMIT
Turned out that our staging server didn't include all the Heroku add-ons the live server has.
One of the add-on missing was Flying Sphinx. Some of our models assume Sphinx was there and would try to use it causing that behavior.

Resources