Dave Hrycyszyn
2011-09-05 11:18:19 UTC
Hi,
I'm using xmpp4r on a project, and every few days, Passenger locks up completely, with one or more Ruby processes running at full CPU utilization.
Hitting those Ruby processes with a "kill -6" as described in the Passenger docs generates a handy stack trace. It appears that the Ruby processes are stuck in these lines of code, in xmpp4r's lib/xmpp4r/semaphore.rb file:
# Waits until are available some free tickets
def wait
@lock.synchronize {
@cond.wait(@lock) while !(@tickets > 0)
@tickets -= 1
}
end
Specifically, it's stuck in line 24, @cond.wait(@lock) while !(@tickets > 0).
This is a little nerve-wracking, but as I can't see any references on the net to people having locking problems with xmpp4r, I'm hoping there's a simple fix.
Our application is a Padrino application which accepts incoming form parameters, and as the byproduct of one action, sends off an xmpp message from a method in an activerecord model. There's nothing particularly exotic about it:
def xmpp_notify
jabber = Jabber::Simple.new(sharer.jid, sharer.password)
msg = Message.new(:subject => link.url)
msg.body = message unless message.nil?
recipients.each do |recipient|
jabber.deliver(recipient.jid, msg)
end
end
We can reliably produce locking problems by doing something like ab -c 2 -n 1000 http://my.system.domain/path/to/controller/action
The app also locks up at low levels of non-automated concurrency. Has anyone else ever run across this?
Is there a fix anyone can recommend? Would bumping up Openfire's receive rate help at all?
Regards,
Dave
I'm using xmpp4r on a project, and every few days, Passenger locks up completely, with one or more Ruby processes running at full CPU utilization.
Hitting those Ruby processes with a "kill -6" as described in the Passenger docs generates a handy stack trace. It appears that the Ruby processes are stuck in these lines of code, in xmpp4r's lib/xmpp4r/semaphore.rb file:
# Waits until are available some free tickets
def wait
@lock.synchronize {
@cond.wait(@lock) while !(@tickets > 0)
@tickets -= 1
}
end
Specifically, it's stuck in line 24, @cond.wait(@lock) while !(@tickets > 0).
This is a little nerve-wracking, but as I can't see any references on the net to people having locking problems with xmpp4r, I'm hoping there's a simple fix.
Our application is a Padrino application which accepts incoming form parameters, and as the byproduct of one action, sends off an xmpp message from a method in an activerecord model. There's nothing particularly exotic about it:
def xmpp_notify
jabber = Jabber::Simple.new(sharer.jid, sharer.password)
msg = Message.new(:subject => link.url)
msg.body = message unless message.nil?
recipients.each do |recipient|
jabber.deliver(recipient.jid, msg)
end
end
We can reliably produce locking problems by doing something like ab -c 2 -n 1000 http://my.system.domain/path/to/controller/action
The app also locks up at low levels of non-automated concurrency. Has anyone else ever run across this?
Is there a fix anyone can recommend? Would bumping up Openfire's receive rate help at all?
Regards,
Dave