I have a VF Page where I gather data from Attachments, deserialize the Attachments into Apex Classes, process the data, and then display the data on the VF page with ContentType="application/vnd.ms-excel".

When trying to load the VF Page, I encounter the following error:

Time limit exceeded - Your request exceeded the time limit for processing.

But when checking the Debug Logs, I have my Maximum CPU Time: 1069 out of 10000.

I suspect this is a Visualforce timeout, and that it is very likely I have to change my data processing in order to create the desired spreadsheet. Are my suspicions correct?

I'm nearly certain that the timeouts occur due to the use of JSON methods. My guess is that these methods don't count against Maximum CPU Time but that each Visualforce request has a time out of ~15 seconds.

When I try collecting the data in Execute Anonymous, I can pull all my desired data without breaching the Maximum CPU Time Limit (~3000 out of 10000), but the requests take ~20-30 seconds to come back with a result.

I am trying to prove that JSON is causing my errors by creating sObject records for my JSON data in a Dev Org, and even so, I am still running into the same Visualforce Timeout. I am only dealing with < 4000 records concerning only 5 fields in each record, and even when I replace the JSON.deserialize with SOQL queries, and I am still timing out. In all of my Debug Logs, I am never using more than 3000 in my Maximum CPU Time. Is my data processing too intensive though I never breach any Governor Limit? The "Time limit exceeded" error is not an Apex Exception, so I can only surmise this is somehow a Visualforce error. Does this seem logical?


Since I am heavily using Apex, I ended up chopping my code up into steps using @future methods since they have 60,000 ms of CPU Time (rather than the normal 10,000 ms) and then have the methods save data a JSON attachments along the way. The first thing an @future methods does is query the Attachment & deserialize the data before continuing processing. The user has to navigate a couple of processing steps, but since @future methods have a callback when invoked in JavaScript, I can easily display to the User when the next step is available. The final VF Page just queries the data and deserializes it like the @future methods do, and this is easily within VF Limits.

  • Is this page a sites page or a page within the org?
    – Eric
    Aug 1, 2014 at 0:48
  • 2
    I get that exact error message quite frequently when trying to edit an Apex class from within the Web UI. I bet it's some kind of HTTP timeout on their web servers, i.e. its timing out because of the time it takes to get a response from the browser. Aug 1, 2014 at 12:41
  • @Eric, within the org Aug 4, 2014 at 19:24

1 Answer 1


I have encountered with this issue.

Actually when you are going to hit the CPU limit through Visualforce page it won't show Maximum CPU Time: 10000 out of 10000

It only shows last method execution time only. But actually you have hit the CPU limit, You can count it manually.

In you your case didn't hit the limit it is the visualforce limit of processing the request and generally happens when generating a PDF, XLS or othe document from visualforce page with huge data.

In case of CPU limit you should get : System.LimitException: Apex CPU time limit exceeded

Sometimes it happens that page never reload completely it shows processing for hours but no result.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .