SharePoint job queued, but never starts - sharepoint

I'm attempting to retract a solution from SharePoint. I've started the job via Central Admin site as well as from stsadm. The job is queued, however, it will stay in a state of pending for days. The SharePoint services - Admin and Timer service - are started.
Any suggestoins of why the retraction jobs are queued, but never started? I'm really at a loss of what to try next, so anything will be helpful.
Thank you!

What happens when you run "STSADM -o execadmsvcjobs" from one of the servers on the farm? this should flush the job queue, displaying any errors occurred along the way.

Make sure the SharePoint 2010 Timer service is running.

Related

Rescheduled to delete more contacts in next off-peak period

In Kentico (9) when I run the task "Delete inactive contacts" it never actually runs and the result is always "Rescheduled to delete more contacts in next off-peak period"
I've tried changing the settings to run once a week and I've tried creating a custom IDeleteContacts then setting it to use that custom class, but I always get the same result.
Any ideas?
By default, Kentico runs it's scheduled tasks in the tail of regular web requests. That's fine if you have traffic 24/7. If you don't, then you can run into all kinds of nastyness including the issue you're describing now because scheduled tasks are not executing.
If you're running on a Windows server you can setup a service to trigger scheduled tasks. If that's not an option, you can setup monitoring to hit your site every couple of minutes, for example UptimeRobot or Application Insights. You'll get the added bonus of being notified whenever the site goes down.
If you really need to clean up the EMS contacts because it's getting out of control, you can access the database directly and trigger the same stored procedure that the scheduled task uses. It's called [Proc_OM_Contact_MassDelete] and takes a where clause and a batch size. The where clause is where you specify the delete policy. For example
ContactCreated < GETDATE()-60 AND ([ContactEmail] IS NULL PR [ContactEmail]='')
With this where clause the stored proc would process contacts that were created over 60 days ago and don't have an e-mail address yet.
Please be aware that large volumes of EMS data will require database index tuning for this procedure to run within an acceptable period of time. This is true for EMS in general when your site has a decent amount of traffic.
If the standard Kentico cleanup doesn't work, for example because the database is unable to deal with millions of contacts, we've written a script to purge all EMS data. Use with caution ;)
do you have applied the latest hotfix (9.0.50) on your project? There was a bug when the deletion of inactive contacts took longer than 1 minute, the next run of the "Delete inactive contacts" scheduled task was not set, and the task did not execute again. You can download the package directly from this page: https://devnet.kentico.com/download/hotfixes
The "Delete inactive contacts" scheduled task only runs between 2am and 6am based on the servers time the site is running on. You can see this in the documentation. It only ever deletes a batch of 1000 contacts and never more. If you want to "trick" the site into running the scheduled task more, update the time on the server to 1:58am and restart the site.

Azure Webjobs: Does re-publishing associated website cause existing jobs to stop running?

I have an Azure Website where I would like to be able to republish the website without stopping any webjobs that might be running in the background.
Ignoring the fact that it's bad practice to publish while the site is being used, this scenario means that a large queue might keep the webjobs firing 24/7 as load increases on the website.
I'm not sure if publishing the website (and not the webjobs) cause the webjobs (scheduled and on-demand) to cancel. Do they?
I think they do, and in that case, is there anything you can do to prevent that? I risk jobs being stopped halfway-through because of the need to publish, and I don't want to sit there waiting for the queue to be empty before publishing. A method of allowing currently running jobs to finish without starting new runs would be fine too.
If the webjob files are not updated (under wwwroot/app_data/jobs/...) they will not restart.

WebJob doesn't Trigger

I've created a simple Azure WebJob that uses a QueueInput trigger. It deployed without any problems and I've schedule it via the management portal so that it 'Runs continuously'
Initial testing seemed fine, with the job triggering shortly after placing anything in the queue.
By chance I then left it about a day before placing anything else in the queue. This time the job hadn't triggered within a few minutes so I logged in to the portal to view the invocation logs - which showed that the job had just that moment been triggered.
That seemed too much of a coincidence so I left it another day before placing something in the queue. Again, the job didn't trigger. I left it overnight and by morning it still hadn't triggered.
When I logged in to the management portal this time I noticed that the job was marked as 'Aborted' on the WebJobs page. It was like that only for about 10 seconds before the status changed to 'Running'. And then the job immediately triggered from what was placed in the queue the night before, as expected.
As it's an alpha release I'm expecting glitches. Just wondering whether anyone else has had a similar experience.
For WebJobs SDK, your job must be running in order to listen for triggers (new queue messages, new blobs, etc). Azure Websites free tier has quotas and will put your job to sleep which means it's no longer listening on triggers. Using the site may cause it to come back to life and start listening to triggers again.
The SDK dashboard will show a warning icon next to functions if the hosting job is not running (it detects this via heartbeats).
Make sure that your website is configured with the "Always On" setting Enabled.
If your site contains continuously running jobs they may not perform reliably if this setting is disabled.
http://azure.microsoft.com/en-us/documentation/articles/web-sites-configure/
By default, web sites are unloaded if they have been idle for some period of time. This lets the system conserve resources. You can enable the Always On setting for a site in Standard mode if the site needs to be loaded all the time. Because continuous web jobs may not run reliably if Always On is disabled, you should enable Always On when you have continuous web jobs running on the site.

JobDefinitions for Timer Jobs in SharePoint

I've hit an issue with creating a timer job on demand from within an event handler. It works fine on my dev machine where the user is also the farm administrator. On the staging server (and production too), this user will be different. Apparently it needs to be a farm admin who creates/updates timer jobs as they have access to the configuration db.
I used a timer job to cope with the notion that many items could be updated at once using the datasheet and if that happened, I wanted an update rollup to take place at a defined period after the edits.
I'm now thinking I may have to set up a recurring timer job instead of a "once" job and within the timer job, check for certain conditions being true before doing any work.
Any suggestions on how I could achieve my desired result of having a rollup function run after any updates, but not after every one?
The previous answer is not correct, or at least not correct for SharePoint 2010. You cannot create job definitions in 2010 in this way even with elevated privileges, as they must be created from central administration. I had a similar problem and this was my finding
this is a blog I wrote about that
I would suggest that you make an event receiver that with a delay of say 10 minutes (timer or thread sleep) and register itself in say web property bag, so that another instance would not run. This could solve the problem.
See http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx to fix the permissions problem.

SharePoint timer jobs not getting invoked

I have a timer job which has been deployed to a server with multiple Web front ends.
This timer job reads it's configuration from a Hierarchical Object Store.
This timer job is scheduled to run daily on the server.
But the problem is that this timer job is not getting invoked daily. I have implemented event logging in the timer job's Execute() method, but I dont see any logs being generated.
Any ideas as to what could cause a timer job to be not picked up for execution by the SharePoint Timer Service? How can I troubleshoot this problem?
Are there any "gotcha"s for running timer jobs in servers from multiple front ends? Will the timer job get execute in all the web front ends, or any one of them arbitarily? How to know which machine will have my event logs?
This might be a stupid question, but does having multiple front ends for load balancing affect the way Hierarchical Object Stores behave?
EDIT:
One of the commenters, Sean McDounough, (Thanks Sean!! ) made a very good point that:
"whether or not the timer job runs on all WFEs will be a function of the SPJobLockType enum value you specified in the constructor. Using a value of "None" means that the job will run on all WFEs."
Now, my timer job is responsible for sending periodic mails to a list of users. Currently it is marked as SPJobLockType.Job"
If I change this to SPJobLockType.None, does this mean that my timer job will be executed in all the WFEs separately? (THis is not desired, it will spam all the users with multiple emails)
Or does it mean that the timer job will execute in any one of the WFEs, arbitarily?
Try restarting the SharePoint timer service from the command-line using NET STOP SPTIMERV3 followed by a NET START SPTIMERV3. My guess is that the timer service is running with an older version of your .NET assembly. The timer service does not automatically reload assemblies when you upgrade the WSP solution.
To do this, follow these steps:
Stop the Timer service.
Click Start, point to Administrative Tools, and then click Services.
Right-click Windows SharePoint Services Timer, and then click Stop, or Restart service.
This URL helped me.

Resources