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

[Service Bus] Inconsistencies with errors when settling deferred message in ReceiveAndDelete mode #10395

Closed
ramya-rao-a opened this issue Aug 2, 2020 · 3 comments
Assignees
Labels
blocking-release Blocks release bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. Service Bus
Milestone

Comments

@ramya-rao-a
Copy link
Contributor

In the below JavaScript code using Service Bus version 7.0.0-preview.4, we

  • send a message
  • receive and defer the message
  • receive this deferred message in ReceiveAndDelete mode
  • settle this receive message, catch any error thrown at this point

The expectation is that the client throws a meaningful error as the message cannot be settled due to it being received in ReceiveAndDelete mode.

const { ServiceBusClient } = require("@azure/service-bus");

const connectionString = "connection string here";
const queueName = "queue name here";

async function main() {
  const sbClient = new ServiceBusClient(connectionString);

 // Send message
  const sender = sbClient.createSender(queueName);
  await sender.sendMessages({
    body: "hello2"
  })

 // Receive in PeekLock mode and defer
  let peekLockReceiver =  sbClient.createReceiver(queueName, "peekLock");
  const [msg] = await peekLockReceiver.receiveMessages(1);
  await msg.defer();
  await peekLockReceiver.close();

 // Receive deferred msg in ReceiveAndDelete mode and complete it
  let receiveAndDeleteReceiver =  sbClient.createReceiver(queueName, "receiveAndDelete");
  const [deferredMsg] = await receiveAndDeleteReceiver.receiveDeferredMessages(msg.sequenceNumber);

  try {
    await deferredMsg.complete();
  } catch (error) {
    console.log("Error when completing deferred message in Receive And Delete mode:", error)
  }
  await sbClient.close();
}

main();

Inconsistent results:

  • We see the TypeError: Cannot read property 'name' of undefined error in below cases
    • unpartitioned queue
    • unpartitioned subscriptions
    • partitioned subscriptions with sessions
    • unpartitioned subscriptions with sessions
    • partitioned queue with sessions
    • unpartitioned queue with sessions
  • We see no errors with
    • partitioned queue
    • partitioned subscriptions

Where as trying to settle a normal i.e. non deferred message received in ReceiveAndDelete mode gives a very useful error "Failed to complete the message as the operation is only supported in 'PeekLock' receive mode"

@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Aug 2, 2020
@ramya-rao-a ramya-rao-a added bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. Service Bus labels Aug 2, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Aug 2, 2020
@ramya-rao-a ramya-rao-a added blocking-release Blocks release needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Aug 2, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Aug 2, 2020
@ramya-rao-a ramya-rao-a added this to the [2020] August milestone Aug 2, 2020
@ramya-rao-a
Copy link
Contributor Author

Same problem for when trying to renew lock on a deferred message that was received in Receive And Delete mode.

We see the TypeError: Cannot read property 'name' of undefined error in below cases

  • unpartitioned queue
  • unpartitioned subscriptions

We see no errors with

  • partitioned queue
  • partitioned subscriptions

Where as trying to renew lock on a normal i.e. non deferred message received in ReceiveAndDelete mode gives a very useful error "Failed to renew lock on the message as the operation is only supported in 'PeekLock' receive mode"

@ramya-rao-a
Copy link
Contributor Author

The root cause for why the partitioned queue/subscription with no sessions return no error from the service is most probably the same as the one for #2268, but we should be able to do better on the client side even if the service is buggy

@ramya-rao-a
Copy link
Contributor Author

Fixed with #10396

@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocking-release Blocks release bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. Service Bus
Projects
None yet
Development

No branches or pull requests

2 participants