Bug 735810 - SystemManagerRemote.setSystemConfiguration can invalidate the internal cache of system settings
Summary: SystemManagerRemote.setSystemConfiguration can invalidate the internal cache ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Core Server
Version: 4.1
Hardware: Unspecified
OS: Unspecified
high
high vote
Target Milestone: ---
: ---
Assignee: RHQ Project Maintainer
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks: jon30-bugs
TreeView+ depends on / blocked
 
Reported: 2011-09-05 14:25 UTC by Lukas Krejci
Modified: 2012-02-07 19:27 UTC (History)
2 users (show)

Fixed In Version: 4.2
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-02-07 19:27:37 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Bugzilla 730335 None None None Never

Internal Links: 730335

Description Lukas Krejci 2011-09-05 14:25:17 UTC
Description of problem:
SystemManagerRemote.setSystemConfiguration() method assumes that the Properties passed to it contain a superset of all the properties that are already defined in the database (i.e. it correctly handles the scenarios where the properties passed to it contain the same names or contain the same names and some new ones).

The cached properties that are then used in other places in the code are assigned to a copy of properties passed to this method. This results in the fact that the properties that are in the database but weren't in the passed in properties suddenly seem to have disappeared even though they are still present in the database.

This condition is intermittent because the system config cache is being reloaded every minute but still opens a window where the business layer reports inconsistent data.

Because setSystemConfiguration() is a remote method we should make it as robust as possible.

How reproducible:
always

Steps to Reproduce:
1.Using the CLI, log in as a user having at least MANAGE_SETTINGS privs:
var props = SystemManager.systemConfiguration;
pretty.print(props.get("CAM_BASE_URL");//prints out the URL of the server
props.remove("CAM_BASE_URL");
SystemManager.setSystemConfiguration(props, false);
props = SystemManager.systemConfiguration;
pretty.print(props.get("CAM_BASE_URL"); //prints nothing
//.... wait a couple of minutes
props = SystemManager.systemConfiguration;
pretty.print(props.get("CAM_BASE_URL"); //prints the URL again
  
Actual results:
see steps

Expected results:
no inconsistency in the reported properties

Additional info:

Comment 1 Lukas Krejci 2011-09-27 21:22:21 UTC
commit 72430377515c26d205d7664485fcb69d19db14e4
Author: Lukas Krejci <lkrejci@redhat.com>
Date:   Fri Sep 9 16:25:55 2011 +0200

    BZ-735810 - make sure to reload the system config cache after its update.

Comment 2 Sunil Kondkar 2011-09-30 11:11:18 UTC
Verified on build#449 (Version: 4.1.0-SNAPSHOT Build Number: 4d56f0b)

Created a user and assigned MANAGE_SETTINGS privileges to the user. Logged in to the CLI with the user.
Below are the steps followed.

var props = SystemManager.systemConfiguration;
pretty.print(props.get("CAM_BASE_URL"));       //prints out the URL of the server
props.remove("CAM_BASE_URL");
SystemManager.setSystemConfiguration(props, false);
props = SystemManager.systemConfiguration;
pretty.print(props.get("CAM_BASE_URL"));       //prints the URL of the server
//.... wait a couple of minutes
props = SystemManager.systemConfiguration;
pretty.print(props.get("CAM_BASE_URL"));       //prints the URL again

Comment 3 Mike Foley 2012-02-07 19:27:37 UTC
changing status of VERIFIED BZs for JON 2.4.2 and JON 3.0 to CLOSED/CURRENTRELEASE


Note You need to log in before you can comment on or make changes to this bug.