function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
gtuerkgtuerk 

Maximum stack depth reached

One of my users received this error message.  I believe it relates to the amount of logging going on in our implementation.  can anybody confirm?  I can't find reference to this in SF documentation
Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

According to the docs:

 

Total stack depth for any Apex invocation that recursively fires triggers due to insertupdate, or delete statements  is 16.  

 

Sounds like triggers may be the area to look into. 

All Answers

bob_buzzardbob_buzzard

This isn't to do with logging, rather its a governor limit that has been broken.

 

The stack is used to hold method call and parameter information.

 

This normally means you've got something in a recursive loop of method calls. 

bob_buzzardbob_buzzard

According to the docs:

 

Total stack depth for any Apex invocation that recursively fires triggers due to insertupdate, or delete statements  is 16.  

 

Sounds like triggers may be the area to look into. 

This was selected as the best answer
gtuerkgtuerk
Yeah.  we have some issues in there...  Did this governor limit change recently?  The same code was working fine yesterday.
bob_buzzardbob_buzzard

I doubt it will have changed outside of a new version of the platform, and Spring '10 isn't scheduled for sandboxes until this weekend.

 

You most likely just got lucky and went over a tipping point. 

gtuerkgtuerk
Thanks for the link - traced this back to a BAD user inserting metadata that threw our code into a circular dependency.  THIS IS WHY GOVERNOR LIMITS ARE GOOD!!!
TehNrdTehNrd
I'm getting this same error with a "List<DiscountSchedule__c> ds = Database.query(query);" statement. No DML is occuring. Any ideas?