dapr / components-contrib

Community driven, reusable components for distributed apps
Apache License 2.0
550 stars 482 forks source link

SQS/SNS Pub-Sub: Message Processing Canceled During Health Check Failures or Graceful Shutdown #3618

Open Runnable1996 opened 3 days ago

Runnable1996 commented 3 days ago

Expected Behavior

Actual Behavior

Steps to Reproduce the Problem

  1. Set up Dapr with Amazon SQS and SNS for pub/sub.

  2. Subscribe to an SQS queue with Dapr.

    • Simulate a high load to cause a Dapr health check failure. Observe that the message being processed is canceled.
    • Start handling a message and send a SIGTERM signal to initiate a graceful shutdown.
  3. Observe that the current message being processed is canceled rather than completing, contrary to expectations.

Additional Context

I suspect the issue might be related to the ctx passed in the processMessage function. It appears that the context is tied to the subscription itself, and replacing it with a context independent of the subscription lifecycle might resolve this issue.

Runnable1996 commented 3 days ago

Hi, @ItalyPaleAle, @yaron2, I would greatly appreciate your insights on this issue. Thank you in advance!

yaron2 commented 1 day ago

@JoshVanL can you kindly verify if the wrong context is being used here?