jeudi 26 mars 2015

Time out connection coming from rabbitmq While creating channel in rails passenger server

hi i am running my rails application in passenger server with rabbitmq conncetinon class (singleton it initialize every time it is is called)



class RabbitmqConnect

attr_accessor : connection

include Singleton

def initialize

credentials = {:host => "localhost", :port => "5126", :user => user1, :password => "sam1", :heartbeat => :server, :automatically_recover => true, :network_recovery_interval => 4, :recover_from_connection_close => true, :logger => Rails.logger,:threaded => true}

conn = Bunny.new(credentials)

conn.start

Rails.logger.info "Connected to rabbitmq with credentials: " +
credentials.inspect

@connection = conn

rescue Bunny::Exception => e

Rails.logger.error "Couldn't connect to rabbitmq with credentials: " + credentials.inspect

Rails.logger.error "Exception: #{e.inspect} #{e.backtrace}"

rescue Exception => e

Rails.logger.error "Exception durng rabbitmq connection: #{e.inspect} #{e.backtrace}"

end

end

return @connection

end

end


but when ever i am trying creating channel after starting my server



channel = RabbitmqConnect.instance.conns.create_channel


i am getting an exception:



Transaction queueing failed with params: {:driver_id=>9972545773, :rating=>"2"}
Exception: #<Timeout::Error: execution expired>
["/Users/pourush/.rvm/gems/ruby-2.1.2/gems/bunny-1.6.3/lib/bunny/concurrent/continuation_queue.rb:25:in pop'",
"/Users/pourush/.rvm/gems/ruby-2.1.2/gems/bunny-1.6.3/lib/bunny/concurrent/continuation_queue.rb:25:in `block in poll'",
"/Users/pourush/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/timeout.rb:91:in `block in timeout'",
"/Users/pourush/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/timeout.rb:101:in `call'",
"/Users/pourush/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/timeout.rb:101:in `timeout'",


But the worst part is that if i change any thing (add a space anwhere in any file and save the file, that's all) in the application after this exception and then again fire any event then i dont get this exception This code is working fine for WEBrick and thin servers plesae help me out to resolve this problem in passenger server


Aucun commentaire:

Enregistrer un commentaire