Please help, I am not sure what is going on.

I have an email service which is processing file attachment.

Yesterday it was almost ready to go to production. I just finalized some test cases. Then I uploaded some data from Production to Sandbox to test email service with real data. After running it with real data (few SObjects have 4000-5000 records) I received a message that my REGEX is too complicated in one of the usages of replaceAll. I tried to apply it on substrings, instead of running on the whole string.

Test is passing fine. But when I am trying to send an email with an attachment I am getting Internal Salesforce.com Errors:

  • Usually it is log limits message, even when I put all log filters to NONE.
  • One or two times it produced different limits: cpu limit, heap limit etc.

I do not know why it started happening just now. Looks like it is related to the fact that I uploaded a few thousands of records to my Test Env. Is there any sort of daily, or total limits which I might be exceeding ?

10:35:33.884 (23884949323)|SYSTEM_METHOD_EXIT|[120]|System.debug(ANY)
10:35:33.884 (23884956915)|SYSTEM_MODE_EXIT|true
10:35:33.884 (23884968008)|METHOD_EXIT|[547]|01pc00000006amx|Utils.addLogMessage(String)
10:35:33.884 (23884982343)|METHOD_ENTRY|[548]|01pc00000006amx|Utils.addLogMessage(String)
10:35:33.884 (23884991454)|SYSTEM_MODE_ENTER|true
10:35:33.886 (23886260120)|SYSTEM_METHOD_ENTRY|[120]|System.debug(ANY)
10:35:33.886 (23886275500)|USER_DEBUG|[120]|DEBUG|DEBUG: addLogMessage, message = DEBUG, addOrgAgenciesIDsToFileData process agency from the ORG orgAgName = Imagine LA
10:35:33.886 (23886282661)|SYSTEM_METHOD_EXIT|[120]|System.debug(ANY)
10:35:33.886 (23886290056)|SYSTEM_MODE_EXIT|true
10:35:33.886 (23886302532)|METHOD_EXIT|[548]|01pc00000006amx|Utils.addLogMessage(String)
*********** MAXIMUM DEBUG LOG SIZE REACHED ***********
10:37:59.799 (169799071975)|FATAL_ERROR|Internal Salesforce.com Error

Salesforce also seems to be retrying to process Email Service: I am not sending any new emails, but judging by the logs files, Salesforce is trying to finish the process for several times:

enter image description here

  • USER_DEBUG|[120]|DEBUG|DEBUG showing up in the log would suggest that the logging filter levels are still set low. Try checking these again to see if you can see what was occurring before the internal server error. If you can get the internal server error Id it would be best to raise a support case with it. Jun 8, 2014 at 19:28
  • 5
    Just to help a bit, the Maximum Log Size is NOT the cause of your error. That is just a message to let you know the log has been truncated. As for reprocessing, check your email service settings and make sure none of the failure settings are set to "Requeue Message"
    – Eric
    Jun 9, 2014 at 4:00

2 Answers 2

  1. There could be issues with your data or the format of the csv

    • Try only sending 100 rows of data and see if it works, then work up from there
  2. Your attempt to use replace, replace all, split, etc fails due to the size.

    • User a custom iterable to process the rows as outlined here:



You can either reduce the Filters on the Debug Logs to keep only relevant filters in it. Also, you can contact Salesforce Support and they can increase the limit of Debug Log Size temporarily.

You must log in to answer this question.

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