acs-aem-commons icon indicating copy to clipboard operation
acs-aem-commons copied to clipboard

"TooManyCallsException" on Generic List with more than 360 entries

Open HelenAlexander1 opened this issue 1 year ago • 4 comments

Required Information

  • [ ] AEM Version, including Service Packs, Cumulative Fix Packs, etc: AEM as a Cloud Service
  • [ ] ACS AEM Commons Version: 6.0.14
  • [ ] Reproducible on Latest? yes

Expected Behavior

A generic list must load all values on the UI despite the number of entries.

Actual Behavior

A generic list with more than 360 items throws "TooManyCallsException" Sling exception and does not list all the title/value pairs on the UI

Steps to Reproduce

On an AEM Cloud Author instance with ACS commons version - 6.0.14 Go to Tools > ACS AEM Commons > Generic List Select the generic list and click on "Properties"

The UI does not list all the title/value pairs on the UI.

And there is an exception in logs as below -

ERROR [203.1.107.254 [1699491744868] GET /mnt/overlay/acs-commons/components/utilities/genericlist.html HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught SlingException org.apache.sling.api.request.TooManyCallsException: BundledScriptServlet (/libs/granite/ui/components/coral/foundation/form/fieldset/fieldset.jsp) at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:529

We know this exception occurs when there are too many inclusions are called in a single sling request. Also that it can be resolved by bumping up the sling.max.calls value of the Sling Main Servlet to a higher value as mentioned in https://github.com/Adobe-Consulting-Services/acs-aem-commons/issues/2975. We used sling.max.calls=5000 which resolves the issue.

But can you please let us know what would be the implications of raising this value on the AEM Cloud instance regarding performance or any other factors. What are the other areas that it might impact? And if there is any ideal upper limit.

Links

Links to related assets, e.g. content packages containing test components

HelenAlexander1 avatar Nov 22 '23 05:11 HelenAlexander1

Try bumping up the sling.max.calls property in the Sling Main Servlet which controls the max number of nested/recursive calls image

YegorKozlov avatar Dec 04 '23 15:12 YegorKozlov

Thanks for your comments YegorKozlov. We would like to know what is the impact of bumping the sling.max.calls value. It does fix the issue, but is there an ideal upper limit?

HelenAlexander1 avatar Dec 05 '23 02:12 HelenAlexander1

The sling.max.calls property is a safety mechanism to prevent infinite recursion or excessive resource consumption in AEM. It limits the maximum number of nested calls that can be made during a single request.

Increasing this value to a very large number can potentially lead to performance issues and increased memory usage. IMO bumping it up reasonably on AEM Author only is okay-ish. The upper limit depends on how many items you have in the list. The default value for sling.max.calls is 1000 and you said 360+ items result in a exception. My guess for sling.max.calls would be 3*N where N is the max number of items in the generic list.

On the other hand, do you really need that many items in the generic list? Your case is hitting the limit. May be a custom implementation , like a datasource reading from a text/json would work better for you?

YegorKozlov avatar Dec 05 '23 09:12 YegorKozlov

Thanks for the explanation YegorKozlov . We are on AEM Cloud and the default value currently is 1500. The issue gets resolved when the value is bumped to 1700. So around 4*N, where N is the max entries in the list. However, as you said the generic list has a high number of items already and it is subject to increase. We will look at ways to see if change the implementation works better in this scenario.

Thanks for the inputs again.

HelenAlexander1 avatar Dec 06 '23 00:12 HelenAlexander1