Open yunhaoling opened 4 years ago
rhea-amqp would get the following error:
Error occurred: ServiceBusError: The lock supplied is invalid. Either the lock expired, or the message has already been removed from the queue. Reference:4343a239-f84c-4c55-9147-8aad89c0f914, TrackingId:742092890000000300000f865fb47b97_G1_B2, SystemTracker:harshan-canary-2:Queue:non-session-445, Timestamp:2020-11-18T01:40:59
at translateServiceBusError (C:\Users\sanallur\Desktop\Work\sb-track-2-samples\node_modules\@azure\service-bus\src\serviceBusError.ts:164:12)
at onMessageSettled (C:\Users\sanallur\Desktop\Work\sb-track-2-samples\node_modules\@azure\service-bus\src\core\shared.ts:63:23)
at Receiver.onSettled (C:\Users\sanallur\Desktop\Work\sb-track-2-samples\node_modules\@azure\service-bus\src\core\messageReceiver.ts:188:16)
at Receiver.emit (events.js:321:20)
at Receiver.EventEmitter.emit (domain.js:482:12)
at emit (C:\Users\sanallur\Desktop\Work\sb-track-2-samples\node_modules\rhea-promise\lib\util\utils.ts:185:20)
at Object.emitEvent (C:\Users\sanallur\Desktop\Work\sb-track-2-samples\node_modules\rhea-promise\lib\util\utils.ts:197:5)
at Receiver.<anonymous> (C:\Users\sanallur\Desktop\Work\sb-track-2-samples\node_modules\rhea-promise\lib\link.ts:328:11)
at Receiver.emit (events.js:321:20)
at Receiver.EventEmitter.emit (domain.js:482:12) {
name: 'ServiceBusError',
retryable: false,
info: null,
code: 'MessageLockLostError',
reason: 'MessageLockLost'
}
In service bus, when a sessionful entity's lock expired, the service would send a detach frame indicating the session lock is lost. However, in uamqp settlement calling, we don't receive and handle amqp frames which means we're unable to detect whether these is a session lock lost, and we send the disposition frame out which would fail silently.
On the other side, even if we do connection.work before sending out the disposition frame and try to get the link detach frame. There is an edge case that when we drain the messages on the session queue, we still cannot receive the detach frame. In this case, the error condition might come up with the disposition outcome which is another feature we're missing, see issue: https://github.com/Azure/azure-uamqp-c/issues/274
It seems like there're two pattern in the service to bubble session lock lost error to the client:
To tackle the issue, we would first need to add the missing disposition outcome feature.