CPU issues caused by process builder and workflows has really gotten bad in last 3 releases - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Lars NielsenLars Nielsen 

CPU issues caused by process builder and workflows has really gotten bad in last 3 releases

I've noticed a massive spike in CPU exceeded limits since Summer 15' and Winter 16'. I've personally looked into the debug logs for about 10 of these (at customer sites) and it seems like the process builder allows the end user to build processes that exceed the CPU limits and the first trigger hit after the workflow throws the exception. It doesn't matter if there is just a single line of code in the trigger to get/set a variable it just throws the exception. 

In my case it is a managed package. I can uninstall my package and the next package in line hits the limits on entrance. 

From everything I can tell it is like the process building and visual workflows are allowing people to build what end up being very poorly writing code behind the scenes (crazy recursion etc) and not respecting the CPU limits but upon exit all of a sudden any custom trigger pays the price. 

Love to get others feedback.

Sincerely, Lars
Salesforce MVP
Jeff MayJeff May
You are correct -- Process Builder is very powerful, and allows users to build multi-record transactions that exceed processing limits. It puts much more emphasis on proper design and effective data modeling.
Lars NielsenLars Nielsen
Sounds like exactly what I am seeing. For example I am working with a customer now that has a massive amount of workflows and processes all tied to leads. When they import more than 1k records everything after that fails but it points the culprit to the first custom trigger or managed package. When you look at the logs however you can see very clearly that it has already exceeded the CPU limit in all the workflows and processes and just throws the expection for outside code.

Exit workflows - message
  Maximum CPU time: 17895 out of 10000 ******* CLOSE TO LIMIT
Enter managed package -  set one single variable - just a boolean
CPU limit exceeded

Last time I checked that should have thrown an excpetion before it got down the chain any further. So is Salesforce just exempting the users from the limits in Process Builder? If so that makes like hard for anyone else after those processes get complete.
Ramesh VaratharajRamesh Varatharaj
Hi Jeff, Lars, need your suggestion. I have encountered the same error and looked at the debug logs. THe CPU time remains at 0 till it enters managed package and spikes suddenly after entering a particular managed package. I am trying to reassign a related user value in contacts and leads, when the value is update in account record. The record which is failing has around 1800 records. pasting here the debug log - the package is from Marketo. When i contacted them, they say it is some code written in Salesforce org. But i do not have complex code - can you throw some light on this please. 
debug log