-
Notifications
You must be signed in to change notification settings - Fork 2k
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] Service bus | Can't disable the prefetch count #17681
Comments
Hello @srnagar , could you please help checking this issue? thanks in advance. |
@yvgopal Could you please take a look at this issue? |
I created a simpler program azure-service-bus-prefetch-demo-simplified.zip to reproduce it. The simpler program does not use multi-threading or coroutines. The program just use its main thread to send and receive message from the same queue. To run the program, first create a queue with the setting:
Then use
to run the built jar. Expected resultNo dead message is produced and the sent message gets received and completed successfully. Actual resultA dead message is produced, and the receiver gets the expired message. |
Hello @yvgopal, good day. Could you please update us with the current progress? Thank you. |
It is not prefetch. But it is a known issue with the Java SDK. It is not prefetch, but the already made but timed out receive requests that cause this. A known issue. We will make a proper fix sometime in the future. Until then, please work around this issue. You can either
I have marked it as a feature request. But it will probably take time for a fix to be delivered. |
Thank you, @yvgopal. Please help update this thread when the issue been fixed in the future. Merry Christmas and Happy new year! |
I am closing this issue as this SDK is deprecated now and a new SDK is released. |
Initial commit for new version and new child resource type extended l… (Azure#17681) * Initial commit for new version and new child resource type extended location New version: 2021-08-31-preview New child resource type: resource sync rule * Fix lint check errors and cross version breaking changes validation issues * Try to fix Cross-Version Breaking Changes * Revert changes to previous stable version * Remove "x-ms-identifiers" definition which will cause golang sdk generation error * Address review comments, revert unnecessary changes * Try fix breaking error * Revert changes which fix lint error but will cause cross version breaking changes * Fix lintdiff validation issue and also add back two updates for this version only * Update descriptions of properties of resource sync rules. * Update description of the resource sync rules API * Update description of resource sync rules selector property * Update description of matchExpressions * Update description of targetResourceGroup * Fix a required LintDiff check Adding "x-ms-identifiers": [] to matchExpressionsList * Add title to readme.typescript.md * Update specification/extendedlocation/resource-manager/readme.typescript.md * Revert cross version breacking changes Co-authored-by: Wei Dong <[email protected]>
Please note that the latest version of the new SDK azure-messaging-servicebus has the fix for this issue. Discussion around this problem can be found in #26632 |
Describe the bug
We found that the message will goto deadletter queue. The message lock duration is set at 20 seconds, max delivery count is set as 1.
After further investigation, we found that the prefetch is enabled. So when thread sleep 40 seconds ( delay(40L * 1000L) ), it continue peek message. But complete operation is after 40 seconds. So server side found those prefetched message lock lost after 20 seconds and moved them to DLQ.
private suspend fun queueReceiveWorker(receiverClient: IMessageReceiver) {
while (true) {
try {
delay(15L * 1000L)
}
According to SDK document the prefetch should be disabled by default. And when we tried to disable prefetch count, it didn't work. It still prefetch the message with prefetchcout == 0
Exception or Stack Trace
Message lock lost exception
To Reproduce
The test programs are built by gradle. If you want to build and try them, make sure you have JDK 8 (or later, e.g. 11) installed and the command “java” is in $PATH. Nothing else is required. Then just invoke gradlew.bat(In Windows) or gradlew(which is a shell script, in Linux) to build. The command line is: gradlew build. After you type gradlew build, gradle wrapper will automatically download gradle binaries and dependencies, and then build the project. In my build script, I set the output location of built jar archive to build/libs. You can find the built artifacts there. Use java –jar NameSpaceConnectionString QueueName to launch the built program. Make sure to set the queue’s max delivery count to 1, and lock duration to 20 seconds, then run the receiver first, wait 30 seconds, and run the sender at last. You can find many dead letter messages, caused by lock expire -> redeliver -> dead letter.
Below are my build, test steps:
PS C:\Users\yuhai\Downloads\test-program\azure-service-bus-prefetch-demo> .\gradlew.bat build
PS C:\Users\yuhai\Downloads\test-program\azure-service-bus-prefetch-demo\build\libs> java -jar .\azure-service-bus-prefetch-demo-0.0.1-SNAPSHOT.jar "Endpoint=sb://yh-sb-standard.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=rmvBkK/te8kXwEXw4AqrzEaKP9/eNYVLvJ1rGe/ErnY=" "testqueue1"
if (message == null) {
logger.info("No message")
delay(40L * 1000L)
Code Snippet
azure-service-bus-prefetch-demo.zip
Expected behavior
Screenshots
Setup (please complete the following information):
The text was updated successfully, but these errors were encountered: