Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple workers reserved the same tickets #13

Open
tfMovamo opened this issue Aug 17, 2020 · 2 comments
Open

Multiple workers reserved the same tickets #13

tfMovamo opened this issue Aug 17, 2020 · 2 comments

Comments

@tfMovamo
Copy link

tfMovamo commented Aug 17, 2020

Hello,
Unfortunately, I can't tell if it's a general beanstalk problem, a bug in here, or in my script.

I have 20 or more workers running (Python 3.6) who get tickets from a tube.


self.beanstalkdConnection.use('imageupload')
self.beanstalkdConnection.watch('imageupload')
self.beanstalkdConnection.ignore('default')

ticket = self.beanstalkdConnection.reserve(1)

if ticket is None:
            print('no jobs')
            return None
else:
            ticketId = ticket.stats().get('id')
            
            if self.mclient.get(str(ticketId)) == None:
                self.mclient.set(str(ticketId), 'in_work', 60)
            else:
                print('no jobs - ticket ' + str(ticketId) + " in progress")
                return None

            ticket.touch()
            self.progress(ticket)
            ticket.delete()

worker 1 reserved the ticket, but all other (19 workers) will reserved this ticket too and give out: 'no jobs - ticket xxxx in progress".

The ttl for an ticket is 500 when i put it into the queue.

Am I doing something wrong? Or is there actually a bug?

greets
Timo

@Roguelazer
Copy link
Contributor

Most likely either you've found a beanstalk bug, or something is making you block for long enough to break the TTR.

One thing I'll note is that this library isn't fork-safe, so if you're connecting to beanstalk prior to forking you may have unusual issues.

@Justintime50
Copy link
Member

@tfMovamo it's been a bit since this was reported. Were you able to find a fix or is this still an issue for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants