My client has a VisualForce page where users are occasionally hitting limit Exceptions (CPU Time and Viewstate Size).

Our team is trying to figure out the frequency of this issue, but I'm not sure how to do that because we aren't getting "Developer script exception" emails when this error happens (I just tested).

Is this expected behavior? If so, does anyone have any suggestions as to how we can detect these limit errors (seems impossible since they can't be caught)?

  • Can you just verify your deliverability settings allow for sends? – Adrian Larson Jun 30 '17 at 7:35
  • @AdrianLarson it's in production and I get exception emails for other types of errors. I also ran "Test Email Deliverability" with no issues. – NSjonas Jun 30 '17 at 18:27
  • Submitted a case with salesforce, however my client doesn't have "premiere" support so they just closed it immediately telling me to use the forms. – NSjonas Jul 7 '17 at 16:35

Seem like this is a platform bug.

I've created a very simple setup to reproduce this:


public class BugTest{

  public void timeout(){

  //used to prove that exceptions emails are being 
  //  sent for non-limit exceptions
  public void divideBy0(){
      Decimal d = 1/0;


VF Page:

<apex:page controller="BugTest">
  <apex:form >
    <apex:commandButton action="{!timeout}" value="timeout" />
    <apex:commandButton action="{!divideBy0}" value="divide by 0" />

When you click the divide by 0 button you should get an exception and then shortly after get an email from salesforce (assuming "email deliverability" is properly setup).

However... when you click the timeout button, you'll get the same exception screen, but will never receive an email from salesforce!

I'm opening a support case with salesforce, so I'll update this with their feedback.


So ya... basically got the answer I expect from salesforce. Known Issue, no real work around.

|improve this answer|||||

This is not expected behavior If you are not getting "Developer script exception" emails when this error happens then it is impossible to figure out the frequency of this issue

|improve this answer|||||
  • Please stop adding signatures to your posts. Your user card is attached to the bottom of each and we can view your profile there. Personal information is off topic noise and will be removed. – Adrian Larson Jun 30 '17 at 7:32

If you are not getting Developer script exception emails then try to check the debug logs, is there any exception handled.

And as you mentioned about - Limit Exceptions (CPU Time and Viewstate Size) it seems

  1. There is no bug in the code but I think best practices is not followed and there are multiple trips to database and
  2. Lot of data is kept in the viewstate. You need to analyse and re-vamp the code so that only needed data is kept in the viewstate
|improve this answer|||||
  • You can't catch limit exceptions. I fully understand why the exceptions are being thrown. We aren't storing any unneeded properties in the viewstate. Users are exceeding the scaling capabilities we originally designed our page to be able to meet. I'm trying to figure out how often it is happening, and thus the frustration that exception emails aren't being sent. – NSjonas Jul 6 '17 at 4:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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