Hi everyone,
I have been using beanstalkd 1.2 with Ruby client 1.0.2 (on Debian
Linux) with some success recently, but today I noticed something that
looks like a bug to me.

My application is using a very simple polling approach to getting
messages from a beanstalk queue, and makes use of reserve-with-timeout
to avoid blocking the app's event loop. This is implemented with the
reserve(timeout) method in the ruby client.

Basically every couple of seconds in a loop I send a "reserve-with-
timeout 0" and if I get TIMED_OUT i just move on and try again after a
few seconds.

It's been working great for my needs, but then I started looking at
the global server stats and i noticed that "current-connections" wan
increasing continuously, once for each reserve-with-timeout that I
sent down to the server.

So I made this minimal test case, which always reproduce the issue for
me:

require 'rubygems'
require 'beanstalk-client'
b = Beanstalk::Pool.new(['127.0.0.1:10701'])
while true
   # just ignore timed_out exception
   job = b.reserve(0) rescue nil
   job.delete if not job.nil?
   sleep 1
   puts b.stats['current-connections']
end

# Output
# => 2
# => 3
# => 4
# and so on...

Can anyone else reproduce this problem ?

Some additional notes:
1) Replacing in the loop above the ruby client with a simple send of
"reserve-with-timeout 0" on a plain socket connection the current
connections count remain stable. So the problem seems confined to the
ruby client.
2) If I introduce message in the queue (from another client), each
reserve(0) that actually return a message will not cause an increase
in connection count.

Am I missing something obvious, or is this really a bug ?
Thanks,
--
Ugo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"beanstalk-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/beanstalk-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to