Unable to cancel messages when using AMQP queues.
Describe the bug
When the Event.cancel() method is invoked for an AMQP queue, the relevant ack method is called. This code tries to acknowledge the message using the receipt field from the Message instance. When this occurs, the ack execution fails because the Event.cancel() code has inserted the trace ID (a UUID value) as the value for receipt, and AMQP expects the receipt field to be convertable to a numeric value.
As a result, we see the following stack trace repeatedly:
java.lang.NumberFormatException: For input string: "2307ffa1-7a2d-42c6-a975-5f2773902216"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67) ~[?:?]
at java.base/java.lang.Long.parseLong(Long.java:711) ~[?:?]
at java.base/java.lang.Long.parseLong(Long.java:836) ~[?:?]
at com.netflix.conductor.contribs.queue.amqp.AMQPObservableQueue.ackMsg(AMQPObservableQueue.java:211) ~[conductor-amqp.jar!/:?]
at com.netflix.conductor.contribs.queue.amqp.AMQPObservableQueue.ack(AMQPObservableQueue.java:194) ~[conductor-amqp.jar!/:?]
at com.netflix.conductor.core.execution.tasks.Event.cancel(Event.java:120) ~[conductor-core.jar!/:?]
at com.netflix.conductor.core.execution.WorkflowExecutorOps.cancelNonTerminalTasks(WorkflowExecutorOps.java:1225) ~[conductor-core.jar!/:?]
at com.netflix.conductor.core.execution.WorkflowExecutorOps.cancelNonTerminalTasks(WorkflowExecutorOps.java:1202) ~[conductor-core.jar!/:?]
at com.netflix.conductor.core.execution.WorkflowExecutorOps.terminateWorkflow(WorkflowExecutorOps.java:724) ~[conductor-core.jar!/:?]
at com.netflix.conductor.core.execution.WorkflowExecutorOps.terminate(WorkflowExecutorOps.java:1644) ~[conductor-core.jar!/:?]
at com.netflix.conductor.core.execution.WorkflowExecutorOps.decide(WorkflowExecutorOps.java:1133) ~[conductor-core.jar!/:?]
at com.netflix.conductor.core.execution.WorkflowExecutorOps.decide(WorkflowExecutorOps.java:1061) ~[conductor-core.jar!/:?]
at com.netflix.conductor.core.reconciliation.WorkflowSweeper.sweep(WorkflowSweeper.java:94) ~[conductor-core.jar!/:?]
at com.netflix.conductor.core.reconciliation.WorkflowSweeper.sweepAsync(WorkflowSweeper.java:75) ~[conductor-core.jar!/:?]
at jdk.internal.reflect.GeneratedMethodAccessor181.invoke(Unknown Source) ~[?:?]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.base/java.lang.reflect.Method.invoke(Method.java:569) ~[?:?]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:355) ~[spring-aop-6.1.14.jar!/:6.1.14]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196) ~[spring-aop-6.1.14.jar!/:6.1.14]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-6.1.14.jar!/:6.1.14]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768) ~[spring-aop-6.1.14.jar!/:6.1.14]
at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:113) ~[spring-aop-6.1.14.jar!/:6.1.14]
at org.springframework.util.concurrent.FutureUtils.lambda$toSupplier$0(FutureUtils.java:74) ~[spring-core-6.1.14.jar!/:6.1.14]
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) [?:?]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
at java.base/java.lang.Thread.run(Thread.java:840) [?:?]
The AMQP integration needs to ensure that cancellation messages contain a parseable delivery tag to ensure that the ack invocation works as expected.
Related: #787 adds dead letter exchange support for AMQP, which could prevent message loss when nack with requeue=false is used.
Tracked in Epic #1677 (production-grade AMQP support).
Hey @nthmost-orkes, just a ping when you get a free moment! I put together PR #1709, which resolves the UUID parsing issue here, hardens nack(), and brings in the Testcontainers integration suite from #1676. Whenever you have bandwidth, could you take a look or point it to the right reviewer? 🙏🏼 Thanks!
9. Hey @nthmost-orkes, just a ping when you get a free moment! I put together PR #1709, which resolves the UUID parsing issue here, hardens nack(), and brings in the Testcontainers integration suite from #1676. Whenever you have bandwidth, could you take a look or point it to the right reviewer? 🙏🏼 Thanks!
Just a quick note, AMQP hasn't been a high priority for us especially as we've been working on SB4 for the 3.34 release, but i WILL circle back to trying to get this in soon!
@jhaabhijeet864 - With your solution, would we still get a constant flow of log messages about the ACK / NACK delivery tag failures? If so, is there anything preventing a change from support the ACK / NACK flow expectations (passing the message-associated tag value)?