Tuesday, February 18, 2014

SharePoint 2010: Usage files are not deleted, causing timer service problems.

On a SharePoint Server 2010 server, the Usage Provider (.usage) files are not deleted from the file system. Additionally, the .usage files keep growing."

The ULS logs were filled with the below errors :

Trace Management Service unable to delete file 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS\VSWSP02N01-20140115-2103.usage'.  Error 00000020

Symptoms

1) The “Microsoft SharePoint Foundation Usage Data Import” timer job never completes.

2) The .usage logs are never deleted. There should typically be no more than 6 .usage files at any given time, but when you have this problem, you may find hundreds or thousands of usage logs in the logging directory.

3) Memory bloat (leak) within owstimer.exe. You may see the timer service consume much more memory than normal. Restarting the timer service will bring it back to normal, but it will build up again over time.
To clear the old .usage files from the file system, I had to restart the SharePoint Timer Services. The .usage files were not getting automatically deleted and this is a known issue.

MS recommends the below action to fix this:

1. Installing December 2013 CU for SharePoint 2010 (I would not recommend this as this too new to install on a PRODUCTION environment)

2. Set up a scheduled task to manually recycle the timer service (at least) once a day -- every 4 to 6 hours would be better.  You can use a PowerShell command like this to recycle the service:  

restart-service -Name SPTimerV4

Then you just need to set up a scheduled task to run it every 6 hours on every SharePoint server in the farm.  When the timer service is manually recycled, the open handles to the .usage files are released, and they will be automatically deleted when the next instance of the Usage Data Import timer job runs (by default every 30 minutes).  There should be no need to manually delete the files. 

Additional Details

Operating System: Windows Server 2012 R2
SharePoint Version: SharePoint Server 2010 SP2


2 comments:

  1. I had the issue where I was not able to delete ULS logs *.usage
    Usually our ULS logs were automatically cleaned by system but since a month it was not deleted somehow. It consumed much space.
    After much search I did “Timer Job Services” Restart. And it automatically deleted all the old logs which were stuck since so long.

    ReplyDelete
    Replies
    1. Perfect, I do that!
      Restart my Service - Sharepoint 2010 Timer and clear automatically my Log Folder, tanks!!!!

      Delete