Redis::CommandError: ERR unknown command - ruby

I was trying redis locally,
launched redis server with
"redis-server"
01 Feb 06:22:50 * Warning: no config file specified, using the default config. In order to specify a config file use 'redis-server /path/to/redis.conf'
01 Feb 06:22:50 - Server started, Redis version 1.000
01 Feb 06:22:50 - The server is now ready to accept connections on port 6379
01 Feb 06:22:51 . 0 clients connected (0 slaves), 5168 bytes in use, 0 shared objects
01 Feb 06:22:54 . Accepted 127.0.0.1:54766
01 Feb 06:22:56 . 1 clients connected (0 slaves), 5888 bytes in use, 0 shared objects
..........
but then when trying to access the redis from rails c console, I keep seeing "Redis::CommandError: ERR unknown command", I don't know what went wrong.
Is this a version compatible issue?
irb(main):009:0> redis = Redis.new(host: 'localhost', port: 6379)
irb(main):008:0* redis.get "1"
Redis::CommandError: ERR unknown command
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/redis-3.2.0/lib/redis/client.rb:110:in `call'
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/redis-3.2.0/lib/redis.rb:784:in `block in get'
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/redis-3.2.0/lib/redis.rb:37:in `block in synchronize'
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/redis-3.2.0/lib/redis.rb:37:in `synchronize'
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/redis-3.2.0/lib/redis.rb:783:in `get'
from (irb):8
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.1.0/lib/rails/commands/console.rb:90:in `start'
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.1.0/lib/rails/commands/console.rb:9:in `start'
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:69:in `console'
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /Users/xx/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.1.0/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'

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'

Redmine is down after attempt to setup smtp configuration

Today I set up a Redmine instance on Ubuntu Server 20.04 for the first time. That worked out quite well so far. So afterwards I set up a Mattermost instance and installed the Redmine Messenger plugin to receive status updates from Redmine in Mattermost. That also worked brilliantly.
Then I wanted to activate email notifications. That unfortunately did not work.
I did the following:
fabrice#redmine:/etc/redmine/default$ sudo nano configuration.yml
and added the following content (with my information)
# Outgoing email settings
production:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: smtp.example.net
port: 25
domain: example.net
authentication: :login
user_name: redmine#example.net
password: redmine
Then I restarted apache and then redmine was down. See image
errormessage
So I deleted the configuration.yml file and restarted apache. Unfortunately that didn't help. I couldn't take any usable information from the logs. (Which doesn't mean there aren't any)
If anyone has an idea how to get Redmine working again, I would be very grateful.
Last lines of redmine production log:
[ActiveJob] Enqueued ActionMailer::DeliveryJob (Job ID: 93923d8a-4e24-4467-847c-b2bdd774fd07) to Async(mailers) with arguments: "Mailer", "settings_updated", "deliver_now", #<GlobalID:0x00007fe514b9c070 #uri=#<URI::GID gid://redmine-app/User/1>>, #<GlobalID:0x00007fe514b938a8 #uri=#<URI::GID gid://redmine-app/User/1>>, ["login_required", "password_min_length"], {:remote_ip=>"192.168.178.174"}
Redirected to http://192.168.178.88/redmine/settings?tab=authentication
Completed 302 Found in 101ms (ActiveRecord: 62.6ms)
[ActiveJob] [ActionMailer::DeliveryJob] [93923d8a-4e24-4467-847c-b2bdd774fd07] Performing ActionMailer::DeliveryJob (Job ID: 93923d8a-4e24-4467-847c-b2bdd774fd07) from Async(mailers) with arguments: "Mailer", "settings_updated", "deliver_now", #<GlobalID:0x00007fe514b674d8 #uri=#<URI::GID gid://redmine-app/User/1>>, #<GlobalID:0x00007fe514b66bf0 #uri=#<URI::GID gid://redmine-app/User/1>>, ["login_required", "password_min_length"], {:remote_ip=>"192.168.178.174"}
[ActiveJob] [ActionMailer::DeliveryJob] [93923d8a-4e24-4467-847c-b2bdd774fd07] Rendering mailer/settings_updated.text.erb within layouts/mailer
[ActiveJob] [ActionMailer::DeliveryJob] [93923d8a-4e24-4467-847c-b2bdd774fd07] Rendered mailer/settings_updated.text.erb within layouts/mailer (3.9ms)
[ActiveJob] [ActionMailer::DeliveryJob] [93923d8a-4e24-4467-847c-b2bdd774fd07] Rendering mailer/settings_updated.html.erb within layouts/mailer
[ActiveJob] [ActionMailer::DeliveryJob] [93923d8a-4e24-4467-847c-b2bdd774fd07] Rendered mailer/settings_updated.html.erb within layouts/mailer (1.1ms)
[ActiveJob] [ActionMailer::DeliveryJob] [93923d8a-4e24-4467-847c-b2bdd774fd07] Performed ActionMailer::DeliveryJob (Job ID: 93923d8a-4e24-4467-847c-b2bdd774fd07) from Async(mailers) in 28.37ms
Started GET "/redmine/settings?tab=authentication" for 192.168.178.174 at 2021-04-13 11:44:09 +0000
Processing by SettingsController#index as HTML
Parameters: {"tab"=>"authentication"}
Settings cache cleared.
Current user: admin (id=1)
Rendering settings/edit.html.erb within layouts/admin
Rendered settings/_general.html.erb (12.0ms)
Rendered settings/_display.html.erb (15.5ms)
Rendered settings/_authentication.html.erb (13.0ms)
Rendered settings/_api.html.erb (4.0ms)
Rendered settings/_projects.html.erb (9.1ms)
Rendered settings/_users.html.erb (12.4ms)
Rendered queries/_columns.html.erb (6.2ms)
Rendered settings/_issues.html.erb (22.5ms)
Rendered queries/_columns.html.erb (3.3ms)
Rendered settings/_timelog.html.erb (8.1ms)
Rendered settings/_attachments.html.erb (5.7ms)
Rendered settings/_notifications.html.erb (0.4ms)
Rendered settings/_mail_handler.html.erb (8.4ms)
Rendered settings/_repositories.html.erb (12.9ms)
Rendered common/_tabs.html.erb (129.0ms)
Rendered settings/edit.html.erb within layouts/admin (129.3ms)
Rendered admin/_menu.html.erb (2.2ms)
Rendering layouts/base.html.erb
Rendered layouts/base.html.erb (7.4ms)
Completed 200 OK in 147ms (Views: 109.9ms | ActiveRecord: 32.0ms)
Edit:
sudo cat error.log | grep redmine
[ 2021-04-15 08:41:59.5086 21857/7f6e840bb700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /usr/share/redmine: An error occurred while starting up the preloader.
/usr/share/redmine/config/application.rb:3:in `require'
/usr/share/redmine/config/application.rb:3:in `<top (required)>'
/usr/share/redmine/config/environment.rb:2:in `require'
/usr/share/redmine/config/environment.rb:2:in `<top (required)>'
[ 2021-04-15 09:31:14.7130 34932/7f564044f700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /usr/share/redmine: An error occurred while starting up the preloader.
/usr/share/redmine/config/application.rb:3:in `require'
/usr/share/redmine/config/application.rb:3:in `<top (required)>'
/usr/share/redmine/config/environment.rb:2:in `require'
/usr/share/redmine/config/environment.rb:2:in `<top (required)>'
[ 2021-04-15 09:36:11.5553 38233/7f07082a9700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /usr/share/redmine: An error occurred while starting up the preloader.
/usr/share/redmine/config/application.rb:3:in `require'
/usr/share/redmine/config/application.rb:3:in `<top (required)>'
/usr/share/redmine/config/environment.rb:2:in `require'
/usr/share/redmine/config/environment.rb:2:in `<top (required)>'
[ 2021-04-15 09:44:59.2308 38883/7f837c1b4700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /usr/share/redmine: An error occurred while starting up the preloader.
/usr/share/redmine/config/application.rb:3:in `require'
/usr/share/redmine/config/application.rb:3:in `<top (required)>'
/usr/share/redmine/config/environment.rb:2:in `require'
/usr/share/redmine/config/environment.rb:2:in `<top (required)>'

Typing "guard" gives an exception

I'm trying to learn Guard using Jeffrey Way's book, but having issues when I do guard. Although I followed the guides without making any mistake.
C:\Users\Imaqtpie\Desktop\LaravelTestingDecoded\chapter3>guard
18:41:48 - INFO - Guard is using TerminalTitle to send notifications.
18:41:48 - INFO - Running all tests
PHP Fatal error: Call to undefined method PHPUnit_Framework_TestResult::allCompletlyImplemented() in C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\guard-phpunit-0.1.4\lib\guard\phpunit\formatters\PHPUnit-Progress\PHPUnit\Extensions\Progress\ResultPrinter.php on line 250
PHP Stack trace:
PHP 1. {main}() C:\Users\Imaqtpie\Desktop\LaravelTestingDecoded\chapter3\vendor\phpunit\phpunit\composer\bin\phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() C:\Users\Imaqtpie\Desktop\LaravelTestingDecoded\chapter3\vendor\phpunit\phpunit\composer\bin\phpunit:63
PHP 3. PHPUnit_TextUI_Command->run() C:\Users\Imaqtpie\Desktop\LaravelTestingDecoded\chapter3\vendor\phpunit\phpunit\PHPUnit\TextUI\Command.php:129
PHP 4. PHPUnit_TextUI_TestRunner->doRun() C:\Users\Imaqtpie\Desktop\LaravelTestingDecoded\chapter3\vendor\phpunit\phpunit\PHPUnit\TextUI\Command.php:176
PHP 5. PHPUnit_Extensions_Progress_ResultPrinter->printResult() C:\Users\Imaqtpie\Desktop\LaravelTestingDecoded\chapter3\vendor\phpunit\phpunit\PHPUnit\TextUI\TestRunner.php:355
PHP 6. PHPUnit_Extensions_Progress_ResultPrinter->printFooter() C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\guard-phpunit-0.1.4\lib\guard\phpunit\formatters\PHPUnit-Progress\PHPUnit\Extensions\Progress\ResultPrinter.php:72
18:41:48 - INFO - .
> [#E489C62F50B0]
> [#E489C62F50B0] Finished in 52 ms
> [#E489C62F50B0]
> [#E489C62F50B0] Fatal error: Call to undefined method PHPUnit_Framework_TestResult::allCompletlyImplemented() in C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\guard-phpunit-0.1.4\lib\guard\phpunit\formatters\PHPUnit-Progress\PHPUnit\Extensions\Progress\ResultPrinter.php on line 250
> [#E489C62F50B0]
> [#E489C62F50B0] Call Stack:
> [#E489C62F50B0] 0.0007 235072 1. {main}() C:\Users\Imaqtpie\Desktop\LaravelTestingDecoded\chapter3\vendor\phpunit\phpunit\composer\bin\phpunit:0
> [#E489C62F50B0] 0.0044 556064 2. PHPUnit_TextUI_Command::main() C:\Users\Imaqtpie\Desktop\LaravelTestingDecoded\chapter3\vendor\phpunit\phpunit\composer\bin\phpunit:63
> [#E489C62F50B0] 0.0044 561304 3. PHPUnit_TextUI_Command->run() C:\Users\Imaqtpie\Desktop\LaravelTestingDecoded\chapter3\vendor\phpunit\phpunit\PHPUnit\TextUI\Command.php:129
> [#E489C62F50B0] 0.0359 2805856 4. PHPUnit_TextUI_TestRunner->doRun() C:\Users\Imaqtpie\Desktop\LaravelTestingDecoded\chapter3\vendor\phpunit\phpunit\PHPUnit\TextUI\Command.php:176
> [#E489C62F50B0] 0.0521 3267312 5. PHPUnit_Extensions_Progress_ResultPrinter->printResult() C:\Users\Imaqtpie\Desktop\LaravelTestingDecoded\chapter3\vendor\phpunit\phpunit\PHPUnit\TextUI\TestRunner.php:355
> [#E489C62F50B0] 0.0521 3267632 6. PHPUnit_Extensions_Progress_ResultPrinter->printFooter() C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\guard-phpunit-0.1.4\lib\guard\phpunit\formatters\PHPUnit-Progress\PHPUnit\Extensions\Progress\ResultPrinter.php:72
18:41:48 - INFO - Guard is now watching at 'C:/Users/Imaqtpie/Desktop/LaravelTestingDecoded/chapter3'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- wdm (LoadError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.0/lib/listen/adapter.rb:207:in `load_dependent_adapter'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.0/lib/listen/adapters/windows.rb:33:in `load_dependent_adapter'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.0/lib/listen/adapter.rb:198:in `usable?'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.0/lib/listen/adapters/windows.rb:25:in `usable?'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.0/lib/listen/adapter.rb:190:in `usable_and_works?'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.0/lib/listen/adapter.rb:57:in `block in select_and_initialize'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.0/lib/listen/adapter.rb:55:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.0/lib/listen/adapter.rb:55:in `select_and_initialize'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.0/lib/listen/listener.rb:290:in `initialize_adapter'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.0/lib/listen/listener.rb:282:in `setup'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.3.0/lib/listen/listener.rb:52:in `start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.2/lib/guard.rb:213:in `block in start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.2/lib/guard.rb:387:in `block in within_preserved_state'
from <internal:prelude>:10:in `synchronize'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.2/lib/guard.rb:384:in `within_preserved_state'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.2/lib/guard.rb:209:in `start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.2/lib/guard/cli.rb:110:in `start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.2/bin/guard:6:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/bin/guard:23:in `load'
from C:/RailsInstaller/Ruby1.9.3/bin/guard:23:in `<main>'
I have tried editing my PATH to point correct PHPUnit, it's still the same.
What's wrong?
Also, should I learn Guard or move Grunt? I'm a PHP dev.
I've found the solution.
The problem was a typing mistake in Ruby1.9.3\lib\ruby\gems\1.9.1\gems\guard-phpunit-0.1.4\lib\guard\phpunit\formatters\PHPUnit-Progress\PHPUnit\Extensions\Progress\ResultPrinter.php which affects 3.7.* versions.
You have to find allCompletlyImplemented() method and rename it to allCompletelyImplemented() on line 250 and 256.

Heroku Postgres Out of Memory error

My Rails app has been running fine until this morning. I tried restarting the app and here is the error i'm getting before i even hit a page. Out of Memory error on the Postgres connection! I can connect fine to the database from my dev machine. I have a Dev account with Heroku Postgres. I also ran that that SQL statement, and it was fine it should just return 1.
The config var DATABASE_URL is set correctly.
Any ideas?
thx,
matt
app[web.1]: => Booting WEBrick
app[web.1]: => Rails 3.2.13 application starting in production on http://0.0.0.0:23827
app[web.1]: => Call with -d to detach
app[web.1]: => Ctrl-C to shutdown server
app[web.1]: Exiting
app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1161:in `exec': PG::OutOfMemory: ERROR: out of memory (ActiveRecord::StatementInvalid)
app[web.1]: DETAIL: Failed on request of size 96.
app[web.1]: : SELECT COUNT(*)
app[web.1]: FROM pg_class c
app[web.1]: LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
app[web.1]: WHERE c.relkind in ('v','r')
app[web.1]: AND c.relname = 'spree_shipments'
app[web.1]: AND n.nspname = ANY (current_schemas(false))
app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2

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