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
Timer triggers not firing or taking a long time to start #614
Comments
This is likely due to the lock behavior that TimerTrigger employs to ensure that only a single instance of your function is running across scaled out instances. Please see this wiki page for more details and recommendations on how to facilitate local debugging/development. |
Hi Mathew, Thanks for the pointer. |
Yes, if you have multiple developers all attempting to run the same job sharing a storage account, there will be lock contention. The lock ID is based the fully qualified function name. You can see the lock blobs in the This issue is related to this issue where we added a new We are working on enabling a way for multiple developers to all share the same storage account and still be able to run concurrently. I'll keep you posted - we'll get a new release out with the updates in week or two. |
We've made changes that are available in the latest prerelease builds to address the issues you pointed out. You can pull our latest prerelease package to try it out (1.1.1-alpha-10216). We've made changes to ensure that for a particular HostId (which is 1:1 with your WebJobs project / fully qualified assembly name) all Singleton locks are isolated within that scope. Now normally you don't worry about the HostId - the SDK manages that for you and assigns one for you. This means that when doing local development, all devs are running with the same HostId and hence the lock contention. The proposal is for devs to use their own HostId during local development. They can do this easily by adding a command line argument to their VS project (which will be stored in their csproj.user file). You can then modify your WebJob startup code to use this HostId if specified (but in production use the default ID): if (config.IsDevelopment)
{
config.UseDevelopmentSettings();
if (args.Length > 0)
{
config.HostId = args[0];
}
} You don't have to use the command line approach - you can set it however you want conditionally. With this approach there will no longer be any locking issues, and you'll also have Dashboard separation of invocations for each HostId. There are some restrictions on HostIds - see JobHost.HostId for details. However you can use descriptive values like "jsmith-dev", etc. |
I have been trying to use the Timer Triggers for 3 webbjobs that live on the same instance. When running locally, they fired the first time no problem. Then I deployed to my text env and everything was just fine. Then they started to not work at all locally and then when deployed, 2 webjobs started to fire after 20 minutes and the 3rd never fired. I have them set at "00:00:30" which I realise doesn't create a monitor by default. I am using the same dashboard credentials for local and for my test environments.
I decided to download the code from github and I have seen the same results when running locally. I commented all the code out of the sample program except the call to config.UseTimers and all the sample example except the 30s timer example. Again, I am using the same dashboard credentials as for my real project and the results are also intermittent. I have gone back to using a loop and thread sleep which is really not ideal so any help would be appreciated.
The text was updated successfully, but these errors were encountered: