Azure / azure-webjobs-sdk

Azure WebJobs SDK
MIT License
738 stars 358 forks source link

Azure Webjobs not getting updated after new publish #1418

Open unnieayilliath opened 6 years ago

unnieayilliath commented 6 years ago

Any changes made to my existing Azure webjob are not reflected. My timer functions still runs in old schedule and also latest changes to code are not reflected.

Repro steps

Create a sample Azure webjob using VS 2017 template. Create a sample timer function in Functions.cs with schedule 5 secs. public static void SampleTimer([TimerTrigger("*/30 * * * * *")] TimerInfo timer, TextWriter log)

Deploy the azure webjob to any Azure API app.

  1. Step B Now change the schedule to 40 secs. Change some code in the timer function "SampleTimer". Redeploy using VS 2017 Publish Azure Webjob.

    Expected behavior

    New changes in code and new schedule should be implemented.

    Actual behavior

    Old code and old schedule still followed.

Known workarounds

Create new API App and publish to that API app.

Related information

Same issue reported previously but closed due to inactivity. https://github.com/Azure/azure-webjobs-sdk/issues/1094

asalvo commented 6 years ago

I experienced this today with one of our web-job deployments. We have a app service plan which runs 2 app services, both of which run a continuous webjob. One of the two app services was running old code even after everything appeared to have been deployed successfully. I even downloaded the assemblies via FTP and confirmed the version number on them.

We did not at the time have good version logging in our workers (that has been corrected today). But there was just enough to confirm our suspicions that we were running old code. I restarted the App Service and stopped and started the continuous web job. One or both of those got the correct version of code running.

We use MSDeploy to deploy our compiled webjob to Azure. We also have auto-scaling enabled, and my first though is that perhaps one of the instances didn't get updated for some reason. The new logging I put in today will help provide more information on what's going on, and I will try to remember to report any additional findings.

rathnamvemula commented 6 years ago

I am facing the same issue with our web job deployments. The weird thing is it execute old code sometime and new code sometimes. I have published and restarted web job many times. Still the issue remains.

tedterrill commented 3 years ago

Not sure if anyone is still checking here, or if this is the same issue, but in case someone comes across this... I had this same problem described by the posters above. I had made changes to our webjob code, then build, and deployed. Once deployed, I noticed the old code was still running. I could easily confirm this because all of my libraries log their version number to our logs in application insights and the logs coming from this one appservice were still using the old version number.

On the appservice, I noticed the new files had been deployed to \site\wwwroot\bin\ but not deployed to \site\wwwroot\app-data\jobs\continuous. I confirmed this in kudu and also by looking at the deployment logs in Azure devops. It turns out, this was the result of someone on our team recently changing our deployment strategy to "WebDeploy" in our Azure Devops pipeline. When the WebDeploy option was selected, there is an Additional Deployment Option called "Exclude files from the App_Data folder" and the checkbox defaulted to checked. This resulted in msdeploy.exe being run with this switch: -skip:Directory=App_Data. This resulted in no files being copied to the app-data directory, thus the webjob was still running with the previous version of our DLLs from the previous deployment. I solved this by unchecking the "Exclude files from the App-Data folder" checkbox in our deployment configuration and redeploying our latest production build to the appservice.