1

I have also asked this question in the MSDN Azure forums, but have not received any guidance as to why my function goes idle.

I have an Azure function running on a Consumption plan that goes idle (i.e. does not respond to new messages on the ServiceBus trigger queue) despite following the instructions outlined in this GitHub issue:

The configuration for the function is the following json:

{
  "ConnectionStrings": {
    "MyConnectionString": "Server=tcp:project.database.windows.net,1433;Database=myDB;User ID=user@project;Password=password;Encrypt=True;Connection Timeout=30;"
  },
  "Values": {
    "serviceBusConnection": "Endpoint=sb://project.servicebus.windows.net/;SharedAccessKeyName=SharedAccessKeyName;SharedAccessKey=KEY_HERE",
  }
}

And the function signature is:

public static void ProcessQueue([ServiceBusTrigger("queueName", AccessRights.Listen, Connection = "serviceBusConnection")] ...)

Based on the discussion in the GitHub issue, I believed that having either a serviceBusConnection entry OR an AzureWebJobServiceBus entry should be enough to ensure that the central listener triggers the function when a new message is added to the ServiceBusQueue, but that is proving to not be the case.

Can anyone clarify the difference between how those two settings are used, or notice anything else with the settings I provided that might be causing the function to not properly be triggered after a period of inactivity?

Jan_V
  • 4,244
  • 1
  • 40
  • 64
Heather_E
  • 13
  • 5
  • If you refer to a specific issue, mind to add a link? Thanks. – Sean Feldman Oct 26 '17 at 20:43
  • Do you have `serviceBusConnection` setting also in app settings in the portal? – Mikhail Shilkov Oct 26 '17 at 21:04
  • @Mikhail - yes, I do also have serviceBusConnection setting in the portal. – Heather_E Oct 27 '17 at 17:29
  • @SeanFeldman, I'm sorry, I'm not sure what you mean. I linked to the Azure forum post and the GitHub issue that I think I am seeing. What other link would you like? – Heather_E Oct 27 '17 at 17:30
  • can you share your function app name either directly or indirectly (https://github.com/Azure/azure-webjobs-sdk-script/wiki/Sharing-Your-Function-App-name-privately)? – ahmelsayed Oct 30 '17 at 20:32
  • @ahmelsayed Sure. The function ID is currently 28923d72-3cb4-40d9-8332-1dcf8758868f, running in EastUS. – Heather_E Oct 31 '17 at 13:26
  • I had same problem when: - created function with Queue Trigger - deleted target Queue - re-created it with same name Solved with re-creating the trigger in the function – George Nov 10 '17 at 15:52

1 Answers1

1

I suggest there are several possible causes for this behavior. I have several Azure subs and only one of them had issues with Storage/Service Bus-based triggers only popping up when app is not idle. So far I have observed that actions listed below will prevent triggers from working correctly:

  • Creating any Storage-based trigger, deleting (for any reason) the triggering object and re-creating it.
  • Corrupting azure function input parameters by deleting/altering associated objects without recompiling a function

Restarting functions app when one of the functions fails to compile/bind to trigger OR input parameter and hangs may cause same problems. It has also been observed that using legacy Connection Strings setting for trigger binding will not work.

Clean deploy of an affected function app will most likely solve the problem if it was caused by any of the actions described above.

EDIT: It looks like this is also caused by setting Authorization/Authentication on the functions app, but I have not yet figured out if it happens in general or when Auth has specific configuration. Tested on affected Azure sub by disabling auth at all - function going idle after 30-40 mins, queue trigger still initiates an execution, though with a delay as expected. I have found an old bug related to this, but it says issue resolved.

George
  • 692
  • 5
  • 10
  • Thank you for the suggestions. When you say **Clean deploy**, do you mean completely deleting the function from Azure and re-creating it during the publishing process from Visual Studio, or something else? And could you explain 'legacy Connection Strings setting'? Since I do have a `ConnectionStrings` setting defined in my configuration I'm wondering if that is the problem. – Heather_E Nov 14 '17 at 14:31
  • @Heather_E You have Application Settings and Connection Strings settings, but you should only use Application Settings section. Connection Strings is a legacy thing Clean deploy means remove the function app and re-create it, then perform a code deploy from CI/VS. It may not be that easy if production is affected - so first try re-creating the function itself. Please note that everything I wrote is for runtime 1.0.xxx – George Nov 14 '17 at 16:13
  • Thank you for the clarification. I won't be able to test this until tomorrow, but you've given me a couple of things to try and I'll make sure to come back and mark your answer as correct if any of them work for me. – Heather_E Nov 14 '17 at 19:40