Hello Raza bin Javed,
Welcome again to the Microsoft Q&A and thank you for posting your questions here.
Problem
I understand that you have deleted a triggered web job from an Azure App Service, but it continues to run in the background, causing data duplication. Despite applying several solutions, including deleting the job from the web job panel, removing associated files, and setting an environment variable to stop the jobs, the issue persists.
Solution
In review the references you provided and what you've done, possible causes of the kind issues here for best practices solution are the followings:
- The deleted job might still have an orphaned process running due to caching or a misconfiguration.
- There might be multiple instances of the job running due to a deployment configuration issue.
- Changes might not be properly synchronized across all instances of the App Service.
So, review the solution you have tried, you can use the link associated with each for more detail steps:
- Deleting the web job from the web job panel: https://learn.microsoft.com/en-us/azure/app-service/webjobs-create#manage-webjobs
- Deleting all associated files from
App_data/Jobs/triggered/job_name:
https://github.com/projectkudu/kudu/wiki/File-Manager - Applying
WEBJOBS_STOPPED = 1
as an environment variable: https://learn.microsoft.com/en-us/azure/app-service/configure-common
So therefore, if you ensure that your steps are correct. Then, to give permant solution that are best practices for the possible causes of the kind issues as I have explained above. Try each of the options below to solve it, each are independent. Utilize the links for more detail steps if you might require it.
- Sometimes, a simple restart of the Azure App Service can resolve issues with orphaned processes.
- Go to your Azure portal.
- Navigate to the App Service.
- Click on the "Restart" button.
- Link: https://learn.microsoft.com/en-us/azure/app-service/quickstart-custom-container?pivots=container-linux#restart-the-app-service
- Ensure that there are no multiple instances of the App Service running the same job.
- Go to your Azure portal.
- Navigate to the App Service Plan.
- Check the instances running and ensure only one instance is handling the job.
- Link: https://learn.microsoft.com/en-us/azure/app-service/manage-scale-up
- If the job is cached, clearing the cache can help.
- Navigate to the App Service.
- Go to "Diagnose and solve problems".
- Search for "Restart and Refresh".
- Choose to restart the service and clear the cache.
- Link: https://learn.microsoft.com/en-us/azure/app-service/web-sites-clear-cache
- Ensure there are no deployment slots that might still have the job running.
- Go to the App Service.
- Check the deployment slots.
- Ensure no slots are running the old job.
- Link: https://learn.microsoft.com/en-us/azure/app-service/deploy-staging-slots
- Manually inspect and delete the job files using Kudu.
- Navigate to your App Service.
- Go to "Advanced Tools" and click "Go" to open Kudu.
- Go to
D:\home\site\wwwroot\App_Data\jobs\triggered
. - Ensure all related files and folders are deleted.
- Link: https://learn.microsoft.com/en-us/azure/app-service/resources-kudu
- Sometimes, updating the settings or reconfiguring the job can help.
- Reconfigure the job settings in the Azure portal.
- Ensure there are no misconfigurations.
- Link: https://learn.microsoft.com/en-us/azure/app-service/webjobs-sdk-get-started
- Inspect the resources and ensure no ghost instances of the job are running.
- Navigate to the Azure Resource Explorer.
- Inspect the App Service.
- Ensure no orphaned jobs are listed.
- Link: https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-explorer
References
All the links are the best resources used for this solution.
Accept Answer
I hope this is helpful! Do not hesitate to let me know if you have any other questions.
** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.
Best Regards,
Sina Salam