beanstalkd / beanstalkd/beaneater
Better handling of Pool and job reserve for multiple connections
- Dominant language
- Ruby
- Stars
- 201
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Description
There is an issue with the pool concept and then with `put` and `reserve`. We should change beaneater_test with https://github.com/beanstalkd/beaneater/blob/master/test/beaneater_test.rb#L6 and test with multiple connections.
The issue is around how reserving works in this case:
``` ruby
@beanstalk = Beaneater::Pool.new(['127.0.0.1:11300', '127.0.0.1:11301'])
@tube = @beanstalk.tubes["foo"]
@tube.put("bar") # <-- put onto connection one
@tube.put("baz") # <-- put onto connection one
```
So now we have two jobs on connection one. If we now call
``` ruby
@tube.reserve
```
Reserve could randomly pick connection two in which case there are no jobs and it would hang forever. Also other variations of this problem when 2 jobs fall into one connection and one into another and calling reserve will eventually start to hang up even though the other connection still has jobs.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with test/beaneater_test.rb around line 6 and reproduce the two-connection examples using the Pool, put, and reserve calls. Then trace the Pool behavior for those methods. Done means tests cover jobs distributed across connections and reserve does not hang while jobs remain available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- backend, distributed-systems, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100