Performance issue - Cache not being used in some cases
Description
Environment
Attachments
- 20 May 2020, 06:03 AM
- 11 May 2020, 10:45 AM
is blocked by
relates to
Activity
This have been addressed in ticket https://idempiere.atlassian.net/browse/IDEMPIERE-4287#icft=IDEMPIERE-4287
Added patch to illustrate the issue of having PO with plain properties context in cache.
To be safe, we probably should log a warning and ignore the call to put such PO into CCache.
For example:
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!
> 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?
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
Hi, while refactoring MSequence to solve the ticket IDEMPIERE-1146: Centralized ID not working with native sequence enabledClosed - 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.