Azure / azure-webjobs-sdk

Azure WebJobs SDK
MIT License
739 stars 358 forks source link

Singleton lock fails with success message #2094

Open jjasloot opened 5 years ago

jjasloot commented 5 years ago

I have a WebJob with a function with the singleton attribute [Singleton("test", SingletonScope.Host)]. When starting the webjob the logging mentions that the lock was acquired but the lock is not actually created.

The reason for that was that I forgot to include AddAzureStorageCoreService to the ConfigureWebjobs

afbeelding as opposed to afbeelding

The issue is that the logs report the lock was acquired but in reality it was not.

Repro steps

In a webjob, use [Singleton("Test", SingletonScope.Host)] on a function. In program.cs configure webjobs as follows:

.ConfigureWebJobs(j => { })

Start the webjob

Logging reads Singleton lock acquired (xxxxxxxe6db0708bd54f3eb745a7ed82/test) No folder 'xxxxxxxe6db0708bd54f3eb745a7ed82' exists in the storage account > azure-webjobs-hosts

Expected behavior

When the lock is not created I want to see the lock was not created in the logging.

Actual behavior

The lock is not created but the logging mentions is was acquired.

Known workarounds

N/A

Related information

fabiocav commented 5 years ago

Adding this to triaged as we can improve the experience here by handling scenarios where a distributed lock manager is required, but a truly distributed lock manager is not registered.