Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

APEX 23.21 Multiple Master / Detail IG's on single page errors when max cached models exceeded

Joe KerrDec 30 2023 — edited Dec 30 2023

Single APEX page with three master/detail, one Master/Detail/detail, One Master/Detail/Detail/Detail IG. Clicking on 5 or 6 different rows leads to browser error

Adding apex.model.setMaxCachedModels(100); on Page Load resolves the issue until about 90 rows are selected (models starts around 15 on initial page load) and the error re-occurs because the 100 limit has been exceeded and does not clear.

Number of page models monitored by watching browser console with the following code in “Function and Global Variable Definition”

(function($) { $('#main').on("interactivegridviewmodelcreate", function(jQueryEvent, data) { let model = data.model; let checkModelList = function(changeType, change) { if (changeType == "addData") { let modelList = apex.model.list(); console.log("Current number of model instances: " + modelList.length); } } model.subscribe({ onChange: checkModelList }); }); })(apex.jQuery);

Page models only resets when Page is Submitted / Loaded. Editing and Saving any particular row in any particular IG does not reset the model count either.

Apex bug?

And, much thanks to @karel-ekema for invaluable assistance who has encountered this issue as well. Would never have found this on my own.

Joe

Comments

John Snyders-Oracle

Likely a bug it seems. Can you put the page in debug mode and test again and provide the console errors.

Joe Kerr

Max cache is set to 100 models

Karel Ekema

When having a look at ConsoleHistory20240103.log, there are 4 lines with a cache overflow; remove model from cache:

3294: debug.js?v=23.2.1:224 Model: cache overflow; remove model from cache: planterms_grid
3314: debug.js?v=23.2.1:224 Model: cache overflow; remove model from cache: benefitgroups_grid
3334: debug.js?v=23.2.1:224 Model: cache overflow; remove model from cache: planbenefits_grid
3354: debug.js?v=23.2.1:224 Model: cache overflow; remove model from cache: employeeparticipants_grid

whereas from earlier log lines, it proves out there are instances of those models in the model cache:

2248: debug.js?v=23.2.1:224 Model: save in cache model: planbenefits_grid,157
2238: debug.js?v=23.2.1:224 Model: save in cache model: benefitgroups_grid,157
2228: debug.js?v=23.2.1:224 Model: save in cache model: planterms_grid,157
2096: debug.js?v=23.2.1:224 Model: save in cache model: employeeparticipants_grid,4

I just found it suspicious that the model level is getting removed whereas there are still instances, so thought of mentioning it. Maybe it's just ok.

Karel Ekema

Sharing a small follow-up experiment

I went back to a page with seemingly the same kind of issue. It's a simple page with 4 IG's, no special configuration (apart from master-detail configs), all grids non-editable.

I left MaxCachedModels untouched, so it's the default 10.

After clicking the 4th project:

Notice the task instances without the ig_tasks_grid level:

I did a source override on model.js, changing getModelLRU() a bit by making sure to get an instance only:

and it seems the problem is gone now! - i can keep clicking projects

it is only removing instances from cache now

The levels remain intact:

@john-snyders-oracle : I'm aware this might not be the real solution, but I thought you may find it interesting

~Karel.

John Snyders-Oracle

Hi Karel, Thanks for your investigation. I am looking into this now.

FYI you may be interested in this internal model method that may be useful for debugging.

apex.model._getStats()

Karel Ekema
1 - 7

Post Details

Added on Dec 30 2023
7 comments
476 views