mysql_adapter undefined method `all_hashes' for nil:NilClass (NoMethodError)
Reported by Neo1975 | June 26th, 2008 @ 08:08 AM
Hi, to all. I hope you can help me. I'm developing a very interesting site using ruby and ruby on rails. With ruby I wrote a crowler that use in first instance Thread.new but I was not suddified about performace so I modified code to handel Kernel.fork But now I have enconter this bug, I think it'a a bug, if not please help me to solve my problem.
I added some puts to look in code. If all go ok (find row and
not find row) I obtaing this: [DF] SQL=>>SELECT * FROM
TABLE WHERE (CONDITION) LIMIT 1<< [DF]
NAME=>>Table Load<< [DF]
RESULT=>>#<Mysql::Result:0xb7996440><<
When somethink go wrong I obtain this [DF] SQL=>>SELECT *
FROM TABLE WHERE (CONDITION) LIMIT 1<< [DF]
NAME=>>Table Load<< [DF] RESULT=>>nil<<
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/mysql_adapter.rb:519:in
select': undefined methodall_hashes' for nil:NilClass
(NoMethodError)
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/query_cache.rb:61:in `select_all'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:582:in `find_by_sql'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:1341:in `find_every'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:1303:in `find_initial'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:534:in `find'
from ./databaseinterface.rb:148:in `find_with_link'
from ./crowler.rb:128:in `lunch_sons'
... 6 levels...
from ./crowler.rb:121:in `each'
from ./crowler.rb:121:in `lunch_sons'
from ./crowler.rb:91:in `go'
from spider.rb:96
the real row number is 516 instead 519(I added 3 lines :)) ).
Thanks.
Comments and changes to this ticket
-
Neo1975 October 27th, 2008 @ 06:32 PM
I wrote a little simple example can reproduce this and other problem: FILE Test.rb
require 'rubygems' require 'databaseinterface_2'
100.times { fork do
30.times do fork do r = Domains.find(:first,:conditions=>["name=?","www.internetpr.it"]) sleep(0.01) end endend }
Process.waitall() puts "FINE"
FILE databaseinterface_2.rb require 'rubygems' require 'activerecord' require 'active_record/fixtures'
ActiveRecord::Base.allow_concurrency = true ActiveRecord::Base.establish_connection(:adapter => "mysql", :host => "localhost", :username => "USERNAME", :password => "PASSWORD", :database => "bubbleth_bubble", :socket => "/var/lib/mysql/mysql.sock") ActiveRecord::Base.connection.instance_eval {@connection.reconnect = true}
class Domains < ActiveRecord::Base end
-
Joshua Peek July 13th, 2008 @ 08:42 PM
- → State changed from new to invalid
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
