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

[🐛 BUG]: Jobs amqp Error while producing messages with same delay and exchange type direct #1792

Closed
1 task done
fereron opened this issue Nov 28, 2023 · 1 comment · Fixed by roadrunner-server/amqp#111
Assignees
Labels
B-bug Bug: bug, exception
Milestone

Comments

@fereron
Copy link

fereron commented Nov 28, 2023

No duplicates 🥲.

  • I have searched for a similar issue in our bug tracker and didn't find any solutions.

What happened?

..

Version (rr --version)

2023.3.6

How to reproduce the issue?

jobs:
  pipelines:
    queue1:
      driver: amqp
      config:
        durable: true
        exchange: amqp.direct
        routing_key: queue1
        exchange_type: direct
        exchange_durable: true
     queue2:
      driver: amqp
      config:
        durable: true
        exchange: amqp.direct
        routing_key: queue2
        exchange_type: direct
        exchange_durable: true
$this->jobs->connect('queue1')->push(
    name: 'queue1',
    payload: 'message',
    options: (new Options())->withDelay(20)
);

$this->jobs->connect('queue2')->push(
    name: 'queue2',
    payload: 'message',
    options: (new Options())->withDelay(20)
);

When producing RR will try to create the same queue delayed-20000.amqp.direct. for them, which will cause an error:

Error 'rpc_push:
	jobs_plugin_push:
	rabbitmq_push:
	rabbitmq_handle_item: Exception (406) Reason: "PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-routing-key' for queue 'delayed-20000.amqp.direct.' in vhost '/': received 'queue2' but current is 'queue1'"' on tcp://127.0.0.1:6001

I think this is happening because we have a direct exchange type and there are no queue names in the pipeline config.
Maybe we should add a check for an empty queue and use "rk" instead at this point?

Relevant log output

2023-11-28T05:08:05+0000	INFO	server      	{"message":"Exception thrown when handling an exception (Spiral\\RoadRunner\\Jobs\\Exception\\JobsException: Error 'rpc_push:\n\tjobs_plugin_push:\n\trabbitmq_push:\n\trabbitmq_handle_item: Exception (406) Reason: \"PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-routing-key' for queue 'delayed-20000.amqp.direct.' in vhost '/': received 'queue2' but current is 'queue1'\"' on tcp://127.0.0.1:6001 at /var/www/project/vendor/spiral/roadrunner-jobs/src/Queue/Pipeline.php line 47)","context":{"exception":{"class":"Spiral\\RoadRunner\\Jobs\\Exception\\JobsException","message":"Error 'rpc_push:\n\tjobs_plugin_push:\n\trabbitmq_push:\n\trabbitmq_handle_item: Exception (406) Reason: \"PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-routing-key' for queue 'delayed-20000.amqp.direct.' in vhost '/': received 'queue2' but current is 'queue1'\"' on tcp://127.0.0.1:6001","code":0,"file":"/var/www/project/vendor/spiral/roadrunner-jobs/src/Queue/Pipeline.php:47","previous":{"class":"Spiral\\Goridge\\RPC\\Exception\\ServiceException","message":"Error 'rpc_push:\n\tjobs_plugin_push:\n\trabbitmq_push:\n\trabbitmq_handle_item: Exception (406) Reason: \"PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-routing-key' for queue 'delayed-20000.amqp.direct.' in vhost '/': received 'queue2' but current is 'queue1'\"' on tcp://127.0.0.1:6001","code":0,"file":"/var/www/project/vendor/spiral/goridge/src/RPC/RPC.php:101"}}},"level":500,"level_name":"CRITICAL","channel":"exception","datetime":"2023-11-28T05:08:05.481257+00:00","extra":{"http_method":"GET","ip":"127.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36","status_code":500}}
@rustatian
Copy link
Member

Hey @fereron 👋
Yes, you're right, this is the bug. We should add some randomness to these values. Will be fixed in the next bugfix release. Thanks for noting that 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-bug Bug: bug, exception
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

2 participants