Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix concurrency issue in QueueManager::processBatch
Error: Uncaught Amp\Beanstalk\DeadlineSoonException causing the ESB to crash
Caused by: Wrong Beanstalk job deleted at the end of the job
Caused by: Multiple Beanstalk jobs for the same job UUID. With multiple concurrent workers that same job UUID will be assigned to multiple workers. $uuidToBeanstalkIdMap[$job->getUuid()] will then only contain one of the beanstalk job ids, so one of the worker's queue manager won't be able to delete his job after finish.
Caused by: Concurrent calls to QueueManager::processBatch() were possible (and should be possible), but the batch itself was shared over multiple HTTP requests. Causing the same job being inserted twice (or more).
Resolved by: Processing the batch via a local variable instead of the shared property.
Steps to reproduce:
for n in {1..10}; do curl 'http://localhost:34981/my-url' 2>/dev/null >/dev/null & done
Ps. I cherry-picked some commits from my other PR's that were required for the travis-ci checks. The main commit in this PR is of course the first one.