Hi, while refactoring MSequence to solve the ticket - I noticed a very bad performance issue because for certain tables the Cache was not being used - in my tests this was mostly AD_RecentItem, but after I added the attached patch
it seems the problem is wider.
It's probably caused by some context not correctly set for multi-threading.
The issue is: the MTable.get methods find the required object in the cache, but is discarded because the context is different, so it goes again to read the record to the database, and if the code requires to get a column (like it was in MSequence) then all the columns are read again from database.
Properly only safe to put a PO into the global static cache (CCache) if it fulfill the following conditions:
getCtx() is an instance of ServerContextPropertiesWrapper
get_TrxName() == null
is make readonly
> getCtx() is an instance of ServerContextPropertiesWrapper
And add a warning here - it doesn't sound good having objects where the context is not the intended context of the whole application?
To be safe, we probably should log a warning and ignore the call to put such PO into CCache.
User1 put PO1 with properties that contains User1 session details into cache
User2 get PO1 from cache
We have many get method that doesn’t validate ctx and with those methods, User2 will get PO1 from cache that contains User1’s session details!
Added patch to illustrate the issue of having PO with plain properties context in cache.
This have been addressed in ticket