Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
ID | ||||||||
0036359 | ||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||
defect | [Openbravo ERP] A. Platform | major | always | 2017-06-27 12:54 | 2017-09-21 16:49 | |||
Reporter | ioritzCia | View Status | public | |||||
Assigned To | alostale | |||||||
Priority | normal | Resolution | fixed | Fixed in Version | 3.0PR17Q4 | |||
Status | closed | Fix in branch | Fixed in SCM revision | ce623b3c1938 | ||||
Projection | none | ETA | none | Target Version | ||||
OS | Any | Database | Any | Java version | ||||
OS Version | Database version | Ant version | ||||||
Product Version | SCM revision | |||||||
Merge Request Status | ||||||||
Review Assigned To | caristu | |||||||
OBNetwork customer | OBPS | |||||||
Web browser | ||||||||
Modules | Core | |||||||
Support ticket | ||||||||
Regression level | ||||||||
Regression date | ||||||||
Regression introduced in release | ||||||||
Regression introduced by commit | ||||||||
Triggers an Emergency Pack | No | |||||||
Summary | 0036359: Cached context for webservices should be regenerated when an organization is activated | |||||||
Description | We cache the context for all webservices inside it being the organization tree. When activating a store it is not inserted in the cached organization list and the security checker starts to fail. | |||||||
Steps To Reproduce | - Launch a webservice to make sure that the context cache is generated. - Activate a store without restarting tomcat - Launch a webservice against a record of that store and see the error in the log (see note) of the organization not being in the organization list | |||||||
Proposed Solution | Make an event when we activate a store/organization or in the copy store to drop that context and force to recreate it again next time | |||||||
Tags | No tags attached. | |||||||
Attached Files | ||||||||
![]() |
|
![]() |
|
(0097710) ioritzCia (viewer) 2017-06-27 12:54 |
Organization 86069CF9D2754372AFEAEE7BE91488D4 of object (OBEDL_Request(9AA394B2B5C74C89B4C8646979FAEF03) (eDLProcess: 04ED002D368141208CA3A855E8A2041F)) is not present in OrganizationList [...] at org.openbravo.dal.security.SecurityChecker.checkWriteAccess(SecurityChecker.java:167) at org.openbravo.dal.security.SecurityChecker.checkWriteAccess(SecurityChecker.java:105) at org.openbravo.dal.core.OBInterceptor.doEvent(OBInterceptor.java:349) at org.openbravo.dal.core.OBInterceptor.onSave(OBInterceptor.java:231) at org.hibernate.event.def.AbstractSaveEventListener.substituteValuesIfNecessary(AbstractSaveEventListener.java:413) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:292) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:203) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:143) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93) at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:685) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:677) at org.openbravo.dal.core.SessionHandler.save(SessionHandler.java:245) at org.openbravo.dal.service.OBDal.save(OBDal.java:260) |
(0098265) hgbot (developer) 2017-07-31 09:10 |
Repository: erp/devel/pi Changeset: 2c0b8265b9b10ea156368e9dcce50cead74d8b29 Author: Asier Lostalé <asier.lostale <at> openbravo.com> Date: Fri Jul 28 11:04:38 2017 +0200 URL: http://code.openbravo.com/erp/devel/pi/rev/2c0b8265b9b10ea156368e9dcce50cead74d8b29 [^] fixed 36359: can get stale cached WS user context When invoking WS, user context is cached in order to prevent its (heavy) creation on every request. This cache was not properly invalidated. Changes to improve this invalidation: 1. Purge cache before trying to retrieve elements, not afterwards. 2. Cache elements already had a valid period of 30 minutes, but this period was restarted everytime the element was used. Now the period starts when the context is cached and it never gets reset. 3. In addition to this expiration time, ADUser.updated was checked when purging cache, and if it was modified since it was cached, it was removed. This implementation had some problems, that are now solved: * ADUser is not the only (nor even the main) entity that when modified can change permissions in cached contexts, therefore modifications in any other entity (ie. Organization) were not triggering cache invalidataion. A new EventObserver taking care of all entities that participate in the permissions definition has been created to invalidate cache. * For every WS request ADUser.updated for every cached context was checked querying DB, adding some performance overhead (specially when many contexts where already cached). As now invalidation occurs in memory, it is not necessary to query DB anymore. This mechanism provides a fully accurate cache when working in a single node. In case of clustered environments, it is possible that caches kept in a node different than the one modifying permissions to continue returning stale contexts, but, as per topic 2, this is restricted to, at most, 30 minutes. --- M src/org/openbravo/service/web/UserContextCache.java A src/org/openbravo/service/UserCtxCacheObserver.java --- |
(0098399) caristu (viewer) 2017-08-04 14:42 edited on: 2017-08-04 14:42 |
Reopened due to failure in CI[1] [1] http://ci.openbravo.com/job/int-checks-pgsql/3118/ [^] |
(0098463) hgbot (developer) 2017-08-10 08:53 |
Repository: erp/devel/pi Changeset: f7c49ae6cfd18d5cb9bd4364fd7f976da3ded190 Author: Asier Lostalé <asier.lostale <at> openbravo.com> Date: Thu Aug 10 08:47:31 2017 +0200 URL: http://code.openbravo.com/erp/devel/pi/rev/f7c49ae6cfd18d5cb9bd4364fd7f976da3ded190 [^] related to issue 36359: fixed related test case Test for preference to allow/disable unpaged datasource request was incorrectly affected by WS user cache beacuse it was mixing WS and datasource request sessions. Being PreferenceCache session scoped, it is not necessary to create Preference through WS, it can be directly created in test as far as it is ensured DS request is performed in a new session. --- M src-test/src/org/openbravo/test/datasource/BaseDataSourceTestDal.java M src-test/src/org/openbravo/test/datasource/TestAllowUnpagedDatasourcePreference.java --- |
(0098464) hgbot (developer) 2017-08-10 08:53 |
Repository: erp/devel/pi Changeset: ce623b3c193862bac0863ac3418480b2cac0c0dc Author: Asier Lostalé <asier.lostale <at> openbravo.com> Date: Thu Aug 10 08:49:37 2017 +0200 URL: http://code.openbravo.com/erp/devel/pi/rev/ce623b3c193862bac0863ac3418480b2cac0c0dc [^] fixed bug 36359: can get stale cached WS user context Don't invalidate cache on Preference modifications as they occur very often and, in general, they shouldn't affect WS sessions. --- M src/org/openbravo/service/UserCtxCacheObserver.java --- |
(0098483) caristu (viewer) 2017-08-11 10:18 |
Code reviewed + tested OK. |
(0099305) hudsonbot (viewer) 2017-09-21 16:49 |
A changeset related to this issue has been promoted main and to the Central Repository, after passing a series of tests. Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/9750b78d3e5c [^] Maturity status: Test |
(0099306) hudsonbot (viewer) 2017-09-21 16:49 |
A changeset related to this issue has been promoted main and to the Central Repository, after passing a series of tests. Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/9750b78d3e5c [^] Maturity status: Test |
![]() |
|||
Date Modified | Username | Field | Change |
2017-06-27 12:54 | ioritzCia | New Issue | |
2017-06-27 12:54 | ioritzCia | Assigned To | => platform |
2017-06-27 12:54 | ioritzCia | OBNetwork customer | => Yes |
2017-06-27 12:54 | ioritzCia | Modules | => Core |
2017-06-27 12:54 | ioritzCia | Resolution time | => 1499724000 |
2017-06-27 12:54 | ioritzCia | Triggers an Emergency Pack | => No |
2017-06-27 12:54 | ioritzCia | Note Added: 0097710 | |
2017-06-27 12:54 | ioritzCia | Steps to Reproduce Updated | View Revisions |
2017-07-14 10:54 | alostale | Status | new => acknowledged |
2017-07-28 12:17 | alostale | Status | acknowledged => scheduled |
2017-07-28 12:17 | alostale | Assigned To | platform => alostale |
2017-07-31 09:10 | hgbot | Checkin | |
2017-07-31 09:10 | hgbot | Note Added: 0098265 | |
2017-07-31 09:10 | hgbot | Status | scheduled => resolved |
2017-07-31 09:10 | hgbot | Resolution | open => fixed |
2017-07-31 09:10 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/devel/pi/rev/2c0b8265b9b10ea156368e9dcce50cead74d8b29 [^] |
2017-08-04 09:33 | alostale | Review Assigned To | => caristu |
2017-08-04 12:32 | caristu | Note Added: 0098391 | |
2017-08-04 12:32 | caristu | Status | resolved => closed |
2017-08-04 12:32 | caristu | Fixed in Version | => 3.0PR17Q4 |
2017-08-04 14:42 | caristu | Note Added: 0098399 | |
2017-08-04 14:42 | caristu | Status | closed => new |
2017-08-04 14:42 | caristu | Resolution | fixed => open |
2017-08-04 14:42 | caristu | Fixed in Version | 3.0PR17Q4 => |
2017-08-04 14:42 | caristu | Note Edited: 0098399 | View Revisions |
2017-08-04 14:42 | caristu | Note Edited: 0098399 | View Revisions |
2017-08-10 08:53 | hgbot | Checkin | |
2017-08-10 08:53 | hgbot | Note Added: 0098463 | |
2017-08-10 08:53 | hgbot | Checkin | |
2017-08-10 08:53 | hgbot | Note Added: 0098464 | |
2017-08-10 08:53 | hgbot | Status | new => resolved |
2017-08-10 08:53 | hgbot | Resolution | open => fixed |
2017-08-10 08:53 | hgbot | Fixed in SCM revision | http://code.openbravo.com/erp/devel/pi/rev/2c0b8265b9b10ea156368e9dcce50cead74d8b29 [^] => http://code.openbravo.com/erp/devel/pi/rev/ce623b3c193862bac0863ac3418480b2cac0c0dc [^] |
2017-08-11 10:18 | caristu | Note Added: 0098483 | |
2017-08-11 10:18 | caristu | Status | resolved => closed |
2017-08-11 10:18 | caristu | Fixed in Version | => 3.0PR17Q4 |
2017-08-11 10:18 | caristu | Note Deleted: 0098391 | |
2017-09-21 16:49 | hudsonbot | Checkin | |
2017-09-21 16:49 | hudsonbot | Note Added: 0099305 | |
2017-09-21 16:49 | hudsonbot | Checkin | |
2017-09-21 16:49 | hudsonbot | Note Added: 0099306 |
Copyright © 2000 - 2009 MantisBT Group |