Project

General

Profile

2.0.1- 500 Internal Server Error: ArgumentError (NULL pointer given)

Added by Quan Tong Anh almost 12 years ago

My versions:

About your application's environment
Ruby version              1.8.7 (i386-linux)
RubyGems version          1.8.10
Rack version              1.4
Rails version             3.2.3
Active Record version     3.2.3
Action Pack version       3.2.3
Active Resource version   3.2.3
Action Mailer version     3.2.3
Active Support version    3.2.3
Middleware                Rack::Cache, ActionDispatch::Static, Rack::Lock, #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0xb7ae5f08>, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Callbacks, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, ActionDispatch::Head, Rack::ConditionalGet, Rack::ETag, ActionDispatch::BestStandardsSupport, OpenIdAuthentication
Application root          /data/www/html/redmine
Environment               production
Database adapter          mysql

Since I'm running Percona XtraDB Cluster on the same server, and due to the Nagios error:

Additional Info: CRITICAL - cannot connect to information_schema. install_driver(mysql) failed: Cant locate DBD/mysql.pm in @INC (@INC contains: ...

I have removed the Percona-XtraDB-Cluster-shared by running:
rpm -e --nodeps Percona-XtraDB-Cluster-shared

then install Percona-SQL-shared and perl-DBD-MySQL.

After that, Redmine give me the error something like:

undefined method `init' for Mysql:Class

and what I've done to fix this problem is:
# gem uninstall mysql
# yum install Percona-XtraDB-Cluster-devel
# gem install mysql -v=2.8.1

but now I'm facing with 500 Internal Server error. The production.log said that:
Completed 500 Internal Server Error in 3ms

ArgumentError (NULL pointer given):
  app/models/setting.rb:152:in `check_cache'
  app/controllers/application_controller.rb:49:in `user_setup'

My gem list:

*** LOCAL GEMS ***

actionmailer (3.2.5, 3.2.3)
actionpack (3.2.5, 3.2.3)
activemodel (3.2.9, 3.2.5, 3.2.3)
activerecord (3.2.9, 3.2.5, 3.2.3)
activeresource (3.2.5, 3.2.3)
activesupport (3.2.9, 3.2.5, 3.2.3)
arel (3.0.2)
brakeman (1.8.0)
builder (3.0.4, 3.0.0)
bundler (1.1.4)
coderay (1.0.8, 1.0.6)
daemon_controller (1.0.0)
daemons (1.1.9)
dbd-mysql (0.4.4)
dbi (0.4.5)
deprecated (2.0.1)
erubis (2.7.0)
eventmachine (0.12.10)
fastercsv (1.5.5)
fastthread (1.0.7)
haml (3.1.7)
highline (1.6.15)
hike (1.2.1)
i18n (0.6.1, 0.6.0)
journey (1.0.4, 1.0.3)
json (1.7.5, 1.7.3, 1.5.1)
json_pure (1.7.5)
mail (2.4.4)
memcache-client (1.8.5)
mime-types (1.19, 1.18)
multi_json (1.5.0, 1.3.6)
mysql (2.8.1)
net-ldap (0.3.1)
openid (0.0.1)
passenger (3.0.12)
pg (0.14.1, 0.13.2)
polyglot (0.3.3)
prototype-rails (3.2.1)
rack (1.4.1)
rack-cache (1.2)
rack-openid (1.3.1)
rack-ssl (1.3.2)
rack-test (0.6.2, 0.6.1)
rails (3.2.3)
railties (3.2.5, 3.2.3)
rake (10.0.3, 0.9.2.2)
rdoc (3.12)
RedCloth (4.2.9)
ruby-openid (2.1.8)
ruby2ruby (1.3.1)
ruby_parser (2.3.1)
rubytree (0.8.2)
sass (3.2.1)
sexp_processor (3.2.0)
sprockets (2.1.3)
sqlite3 (1.3.6)
terminal-table (1.4.5)
thin (1.4.1)
thor (0.15.2, 0.14.6)
tilt (1.3.3)
tree (0.2.1)
treetop (1.4.12, 1.4.10)
tzinfo (0.3.35, 0.3.33)

Google shows me only a few results, include this topic. But it seems not my case.


Replies (2)

RE: 2.0.1- 500 Internal Server Error: ArgumentError (NULL pointer given) - Added by Quan Tong Anh almost 12 years ago

I've tried to upgrade to version 2.2.0, but still got the same error at Step 4 - Update the database:

# rake db:migrate RAILS_ENV=production --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
rake aborted!
NULL pointer given
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/connection_adapters/mysql_adapter.rb:144:in `each_hash'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/connection_adapters/mysql_adapter.rb:144:in `each_hash'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:427:in `each'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:427:in `map'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:427:in `columns'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/connection_adapters/mysql_adapter.rb:325:in `execute_and_free'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:426:in `columns'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/connection_adapters/schema_cache.rb:12:in `initialize'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/connection_adapters/schema_cache.rb:16:in `call'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/connection_adapters/schema_cache.rb:16:in `default'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/connection_adapters/schema_cache.rb:16:in `[]'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/connection_adapters/schema_cache.rb:16:in `initialize'
/usr/lib/ruby/gems/1.8/gems/arel-3.0.2/lib/arel/visitors/to_sql.rb:101:in `call'
/usr/lib/ruby/gems/1.8/gems/arel-3.0.2/lib/arel/visitors/to_sql.rb:101:in `default'
/usr/lib/ruby/gems/1.8/gems/arel-3.0.2/lib/arel/visitors/to_sql.rb:101:in `[]'
/usr/lib/ruby/gems/1.8/gems/arel-3.0.2/lib/arel/visitors/to_sql.rb:101:in `column_for'
/usr/lib/ruby/gems/1.8/gems/arel-3.0.2/lib/arel/visitors/to_sql.rb:364:in `visit_Arel_Attributes_Attribute'
/usr/lib/ruby/gems/1.8/gems/arel-3.0.2/lib/arel/visitors/visitor.rb:19:in `send'
/usr/lib/ruby/gems/1.8/gems/arel-3.0.2/lib/arel/visitors/visitor.rb:19:in `visit'
/usr/lib/ruby/gems/1.8/gems/arel-3.0.2/lib/arel/visitors/to_sql.rb:134:in `visit_Arel_Nodes_SelectCore'
/usr/lib/ruby/gems/1.8/gems/arel-3.0.2/lib/arel/visitors/to_sql.rb:134:in `map'
/usr/lib/ruby/gems/1.8/gems/arel-3.0.2/lib/arel/visitors/to_sql.rb:134:in `visit_Arel_Nodes_SelectCore'
/usr/lib/ruby/gems/1.8/gems/arel-3.0.2/lib/arel/visitors/mysql.rb:41:in `visit_Arel_Nodes_SelectCore'
/usr/lib/ruby/gems/1.8/gems/arel-3.0.2/lib/arel/visitors/to_sql.rb:121:in `visit_Arel_Nodes_SelectStatement'
/usr/lib/ruby/gems/1.8/gems/arel-3.0.2/lib/arel/visitors/to_sql.rb:121:in `map'
/usr/lib/ruby/gems/1.8/gems/arel-3.0.2/lib/arel/visitors/to_sql.rb:121:in `visit_Arel_Nodes_SelectStatement'
/usr/lib/ruby/gems/1.8/gems/arel-3.0.2/lib/arel/visitors/mysql.rb:36:in `visit_Arel_Nodes_SelectStatement'
/usr/lib/ruby/gems/1.8/gems/arel-3.0.2/lib/arel/visitors/visitor.rb:19:in `send'
/usr/lib/ruby/gems/1.8/gems/arel-3.0.2/lib/arel/visitors/visitor.rb:19:in `visit'
/usr/lib/ruby/gems/1.8/gems/arel-3.0.2/lib/arel/visitors/visitor.rb:5:in `accept'
/usr/lib/ruby/gems/1.8/gems/arel-3.0.2/lib/arel/visitors/to_sql.rb:19:in `accept'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `to_sql'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/database_statements.rb:38:in `select_values'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/migration.rb:587:in `get_all_versions'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/migration.rb:745:in `migrated'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/migration.rb:668:in `current_version'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/migration.rb:685:in `migrate'
/usr/lib/ruby/1.8/erb.rb:719:in `detect'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/migration.rb:685:in `each'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/migration.rb:685:in `detect'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/migration.rb:685:in `migrate'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/migration.rb:570:in `up'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/migration.rb:551:in `migrate'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.2.9/lib/active_record/railties/databases.rake:179
/usr/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/task.rb:228:in `call'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/task.rb:228:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/task.rb:223:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/task.rb:223:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/task.rb:166:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/task.rb:159:in `invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/task.rb:152:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/application.rb:143:in `invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/application.rb:101:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/application.rb:101:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/application.rb:101:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/application.rb:110:in `run_with_threads'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/application.rb:95:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/application.rb:73:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.3/lib/rake/application.rb:70:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.3/bin/rake:33
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
Tasks: TOP => db:migrate

I suspect that it relate to the Percona-XtraDB-Cluster-shared - the libraries for MySQL clients. Any thoughts?

RE: 2.0.1- 500 Internal Server Error: ArgumentError (NULL pointer given) - Added by Quan Tong Anh almost 12 years ago

OK. The workaround is:

- uninstall perl-DBD-MySQL:

yum erase perl-DBD-MySQL

- reinstall from CPAN shell:
perl -MCPAN -e 'install DBD::mysql'

- remove Percona-SQL-shared and install Percona-XtraDB-Cluster-shared
yum remove Percona-SQL-shared && yum install Percona-XtraDB-Cluster-shared

- reinstall mysql gem:
gem uninstall mysql
gem install mysql -v=2.8.1

    (1-2/2)