My Function script will get triggerred by Service Bus several times if the script is running more than 5 mins.
setup a queue in ServiceBus with default TTL, Lock time.
set Function App to run with App Service Plan which doesn't have 5 mins timeout limitation
set host.json with "functionTimeout": "00:50:00"
create a python script to receive message from Service Bus queue
send one message to queue and let script sleep 350 seconds
My script get triggered once
After 5 mins and 10 seconds, my script get triggered again
check log here:
https://github.com/SILENCE226/azure/blob/master/function/function.log
from this document
https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus
The message is received by PeekLock mode and should be renewed automatically if the function runs longer than the PeekLock timeout
I suspect the renew mechanism is not working correctly.
My Function script sample code:
https://github.com/SILENCE226/azure/tree/master/function
@brettsam - Feel free to bump the milestone to next month if needed
@brettsam This may be related to the fact that we don't currently expose a Functions knob for configuring OnMessageOptions.AutoRenewTimeout. We would do that here where we allow other SB OnMessageOptions knobs to be configured. Likely in this case, the AutoRenewTimeout needs to be increased.
I confirmed this is what was happening. The default value is 5 minutes so Service Bus was releasing the lock, which caused the function to be invoked again with the same message. I have a PR out that allows you to increase AutoRenewTimeout to a custom value.
Most helpful comment
I confirmed this is what was happening. The default value is 5 minutes so Service Bus was releasing the lock, which caused the function to be invoked again with the same message. I have a PR out that allows you to increase
AutoRenewTimeoutto a custom value.