3

am facing an issue in the timer jobs of my sp farm. From last 2 days, my env. timer jobs are running TWICE. Irrespective of whether its default- OOTB timer jobs or my custom timer jobs, all are running TWICE.

What may be the reason for this weird behavior? because of this multiple running of my custom timer jobs, the functionality of my appln , breaks.
Like, am having 3 timer jobs thats sending emails whenever one business rule satisfies from my site's lists/doc.libs. if I assume, there may be an error in my code,whats the reason for the existing OOTB timer jobs thats running in this farm, also executing TWICE. so that shows, this must be something else, not only related with my custom code, but some other factor.

OOTB TIMERJOBS are running twice:ootbtimer-RUNNING-TWICE

Since its running two times, e-mails are sending to targeted audience 2 times and it causes a big confusion and unable to perform next steps.

When I debugged my custom timer job soln, I analyzed that the Execute() triggers TWICE.Has anyone faced this issue before . if yes,any solutions for this?

Recently, one major activity I have done is, i have taken the backup of the content db of my site and site collec. back up as well and restored to a new web application altogether.

Before this, i have upgraded my single server farm to SP1 with APRIL 2017 CU. My env is one single server with SP 2013 SP1 with APRIL 2017 CU and SQL Server 2012 SP2 is installed on the SAME SERVER and workflow manager as well. Also, all the custom timer jobs created [ 4 wsps] were deployed globally with WebApplication as the scope

I am having multiple contentDBs attached to this web application where the custom timer job is deployed.

1 Answer 1

2

I guess the problem is because of the job lock type of your custom SharePoint Timer jobs, check the constructor in your jobs as shown below,

public TaskLoggerJob (string jobName, SPWebApplication webApplication)
      : base (jobName, webApplication, null, SPJobLockType.ContentDatabase) {
      this.Title = "Task Logger";
    }

In the above code you can see that I'm passing SPJobLockType.ContentDatabase as the job lock type, it indicates that the timer job will run once for each content database associated with the web application with which the timer job is associated.

As you said that now in your web application you have increased the content DB, this might be causing the issue.

For more information about the job lock types, have a look at the below link SharePoint Timer Job Locks and Scope

4
  • yes, i have also found out this as an issue, with multiple content dbs. but even after changing the code in the constructor as mentioned here : blog.mohnady.com/2012/07/fix-sharepoint-timer-jobs-running.html . so i changed the constructor to spjoblocktype.job instead of contentdatabase as a paarmeter. Even after making this code change, timer job still runs TWICE . Thats where am stuck!
    – samolpp2
    Commented Jun 29, 2017 at 12:36
  • after the code change and deployment, did you restart the SharePoint timer job service.?, use this cmd line code, net stop SPTimerV4 net start SPTimerV4 Commented Jun 29, 2017 at 12:44
  • Lemme try and revert ...i restarted the timer services from services.msc console
    – samolpp2
    Commented Jun 29, 2017 at 12:49
  • Karthik, if there is something wrong in my custom timer job, why the other timer jobs are running twice? SharePoint's inbuilt timer jobs should not run twice. But here that theory also broken!
    – samolpp2
    Commented Jun 29, 2017 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.