Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a timer job that runs every night at midnight.

The first part of the timer job is to iterate through every single site in a particular site collection (there are many).

The second part of the timer job is to issue e-mails for each list item that was retrieved in the first part.

Both potentially rather taxing operations.

On one particular environment, the timer job doesn't work (i.e. no e-mails are sent/received), but has been proven on 3 other environments and behaves as expected.

In the ULS logs for the environment with the problem, I can see a lot of the following sorts of entries for this timer job:

An SPRequest object was reclaimed by the garbage collector instead of being explicitly freed. To avoid wasting system resources, dispose of this object...

Potentially excessive number of SPRequest objects (26) currently unreleased on thread 20.

An SPRequest object was not disposed before the end of this thread....this object will now be disposed.

Would you expect that such errors could cause the timer job to stop or fail to execute the 2nd part?

There are no other relevant exceptions in the logs to note.

I am now going to spend time refactoring the code to ensure all objects are disposed of correctly with using statements and run spdisposechecker anyway, but can I confidently say that this may just solve the issue?

PLEASE NOTE The server on which this timer job does not perform has significantly less resources than the other environments. It's processor and RAM are max'd out before even running the timer job so I'd imagine it has no tolerance for memory leaks or poorly disposed objects.

share|improve this question
1  
It might solve the issue. You say the timer job runs fine on all other machines - they should have the same dispose problem, hence it is less likely being the problem. You should first refactor (and add some logging) and see whether that solves your problem. –  Dennis G Jan 15 '13 at 11:03
    
Sorry @moontear - I should've mentioned something rather important which I'll include in the OP now. –  DeeMac Jan 15 '13 at 11:10
1  
Oh, the Server is maxed out on RAM anyways - if your e-mail sending is resource intensive this of course could be your problem. SharePoint needs a lot of RAM, always give it enough. –  Dennis G Jan 15 '13 at 13:19
    
Given the fact I have no control over the resource it's granted - I suppose I can only optimise my code and make the necessary disposal of objects. Thanks a lot @moontear –  DeeMac Jan 15 '13 at 14:11
add comment

1 Answer

up vote 1 down vote accepted

If the server is maxed out on RAM that is where your problem and many other problems might stem from.

You say yourself that the timer job is resource intensive - you will get weird problems if the RAM is maxed out. Your SharePoint objects should be properly disposed otherwise that would add to the size of the RAM of your w3wp threads on the computer.

First: Try to optimize your code with using. Then add more logging and see whether you can find out where the real problem lies. Any foreach over all items in a list is discouraged as it really is a resource hog. Isn't it feasible to use e.g. event receivers and run on each item?

Try to optimize your code first and see if that solves the problem.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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