admin@glassfish.java.net

Re: Code Review: Timeout today in another one hour :)

From: kedar <Kedar.Mhaswade_at_Sun.COM>
Date: Tue, 10 Apr 2007 18:10:50 -0700

Nandini,

It would be nice if these two are related.
I will try to see if this bug has gotten fixed
as well. Thanks for letting me know.

Kedar

Nandini Ektare wrote:
> Kedar,
>
> From the bug context you have sent, looks it might be something
> related to following bug. (Last week I had made some observations for
> that bug)
> *Synopsis*: Node-agent startup status not updated appropriately for instances to startup
> http://bt2ws.central.sun.com/CrPrint?id=6542837
>
> some observations...
> if you create a domain and layout the config for a clustered instance, create node agent and start that agent (for the first such set) eveyrhting works.
> Momemnt you restart DAS OR create a new setup and start node agent, things go awry
>
> I suspected code around setting of domain server's status and sure enough when the node agent for the new setup is started, DAS gets a setRestartRequired !
>
> I suspect config / dynamic reconfig changes might caused this regression. The point where I had trapped the setRequiredStauts Call in RMIClient, the call stack is not very helpful...it shows setRestart is done as part of Loader.registerMBean (What mbean is being registered in DAS when NA starts? Anyway... that's what the call stack said... I suggest instead of relying on this observation you try it yourself - trap and check the call stack for setRestartRequired... once that gets called, everything goes awry...till you shutdown everything and start afresh)
>
> Main thing is all entities are physically running it is just the status part that is messged up (ofcourse, its useless to use so this observation will only help narrow down to actual cause- it provides no workaround. If you try to start domain, NA or instances, you will see - they are already runnign messages - looks like some that code does not rely on stub status)
>
> *** (#3 of 3): 2007-04-07 01:10:51 GMT+00:00 nandini.ektare_at_sun.com
> *** Last Edit: 2007-04-07 01:10:51 GMT+00:00 nandini.ektare_at_sun.com
>
>
> In case, it is related, then a whole slew of instance/DAS/nodeagent
> status related bugs will get resolved. Hence am hoping it is related
> or better yet, is the fix :-)
>
> Nandini
>
>
> kedar wrote:
>> Hello folks,
>>
>> Byron and I have fixed a nasty bug in the cluster environment.
>> There are bunch of bugs that are filed in this regard and the
>> most prominent one is: 6514847 on Sun's database.
>>
>> Please review the attached diff's.
>>
>> Some background: Since node-agent starts the instances in process,
>> it has to make sure that it does not use a cached version of the config
>> context (a cached object referring to domain.xml). At the same time,
>> if a part of code (start-domain) is sure that it is using the right
>> config
>> context, so that there is no duplicate parsing effort, then that part of
>> code should let Launcher know it.
>>
>> I have tested most of the cases.
>>
>> Thanks,
>> Kedar
>> ------------------------------------------------------------------------
>>
>> ? admin/backup/build
>> ? admin/mbeanapi-impl/build
>> ? admin/mbeans/build
>> ? admin/monitor/build
>> ? admin/nbproject/.cvsignore
>> ? admin/servermgmt/admin.log
>> ? admin/servermgmt/build
>> ? admin/templates/pe80/ri-domain.xml.template
>> ? admin/templates/pe80/samples-domain.xml.template
>> ? admin/util/classes
>> ? admin/validator/build
>> ? admin/ws-mgmt/build
>> ? admin-cli/admin-cli.log
>> ? admin-cli/build
>> ? admin-cli/commands/build
>> ? admin-cli/framework/${javadoc.dir}
>> ? admin-cli/framework/build
>> Index: admin/servermgmt/src/java/com/sun/enterprise/admin/servermgmt/RepositoryConfig.java
>> ===================================================================
>> RCS file: /cvs/glassfish/admin/servermgmt/src/java/com/sun/enterprise/admin/servermgmt/RepositoryConfig.java,v
>> retrieving revision 1.4
>> diff -u -w -b -r1.4 RepositoryConfig.java
>> --- admin/servermgmt/src/java/com/sun/enterprise/admin/servermgmt/RepositoryConfig.java 15 Feb 2007 04:32:50 -0000 1.4
>> +++ admin/servermgmt/src/java/com/sun/enterprise/admin/servermgmt/RepositoryConfig.java 11 Apr 2007 00:04:12 -0000
>> @@ -80,10 +80,11 @@
>> *
>> * @author kebbs
>> */
>> -public class RepositoryConfig extends HashMap {
>> +public class RepositoryConfig extends HashMap<String, Object> {
>>
>> public static final String K_INSTALL_ROOT = "install.root";
>> public static final String K_CONFIG_ROOT = "config.root";
>> + public static final String K_REFRESH_CONFIG_CONTEXT = "refresh.cc";
>>
>> //Name of the domain or node agent. Cannot be null.
>> private String _repositoryName;
>> @@ -109,6 +110,12 @@
>> _configurationName = configName;
>> put(K_INSTALL_ROOT, getFilePath(SystemPropertyConstants.INSTALL_ROOT_PROPERTY));
>> put(K_CONFIG_ROOT, getFilePath(SystemPropertyConstants.CONFIG_ROOT_PROPERTY));
>> + put(K_REFRESH_CONFIG_CONTEXT, true);
>> + /* Since the changes for the startup, we have the problem of refreshing
>> + * config context. So, by default, I am making a change to refresh the
>> + * config context. If some processes (e.g. start-domain) have already
>> + * created a config context, then they should explicitly say so.
>> + */
>> }
>>
>> public RepositoryConfig(String repositoryName, String repositoryRoot, String instanceName) {
>> @@ -194,4 +201,13 @@
>> {
>> return (String)get(K_CONFIG_ROOT);
>> }
>> +
>> + public Boolean getRefreshConfigContext() {
>> + return ( (Boolean) get(K_REFRESH_CONFIG_CONTEXT ) );
>> + //this will never be null, because constructor initializes it to false
>> + }
>> +
>> + public void setRefreshConfingContext(final boolean refresh) {
>> + this.put(K_REFRESH_CONFIG_CONTEXT, refresh);
>> + }
>> }
>> Index: admin/servermgmt/src/java/com/sun/enterprise/admin/servermgmt/launch/ASLauncher.java
>> ===================================================================
>> RCS file: /cvs/glassfish/admin/servermgmt/src/java/com/sun/enterprise/admin/servermgmt/launch/ASLauncher.java,v
>> retrieving revision 1.13
>> diff -u -w -b -r1.13 ASLauncher.java
>> --- admin/servermgmt/src/java/com/sun/enterprise/admin/servermgmt/launch/ASLauncher.java 30 Mar 2007 21:40:11 -0000 1.13
>> +++ admin/servermgmt/src/java/com/sun/enterprise/admin/servermgmt/launch/ASLauncher.java 11 Apr 2007 00:04:12 -0000
>> @@ -165,6 +165,9 @@
>> private String[] _args=null;
>> private static boolean bDebug=false;
>>
>> + /* Refresh the config context from the disk, by default */
>> + private boolean refreshConfigContext = true;
>> +
>> // WBN March 2007
>> // The server's logfile is added to the *local* logger. But it is never
>> // removed. The files are kept open by the logger. One really bad result
>> @@ -298,6 +301,14 @@
>>
>> }
>>
>> + public void setRefreshConfigContext(final boolean refresh) {
>> + this.refreshConfigContext = refresh;
>> + }
>> +
>> + public boolean getRefreshConfigContext() {
>> + return ( refreshConfigContext );
>> + }
>> +
>> private void preProcess(String[] args) throws ASLauncherException
>> {
>> // We are being called from a script or native code
>> @@ -713,7 +724,19 @@
>> // derive domain.xml location and create config to be used by config api
>> String domainXMLLocation=System.getProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY)
>> + RELATIVE_LOCATION_DOMAIN_XML;
>> - ConfigContext configCtxt=ConfigFactory.createConfigContext(domainXMLLocation);
>> + //ConfigContext configCtxt=ConfigFactory.createConfigContext(domainXMLLocation);
>> + final ConfigContext configCtxt;
>> + if (this.getRefreshConfigContext()) //refresh, hence cache = false, new CC is returned;
>> + configCtxt = ConfigFactory.createConfigContext(domainXMLLocation, true, false, false);
>> + else //use cached config context
>> + configCtxt = ConfigFactory.createConfigContext(domainXMLLocation, true, false, true);
>> +
>> + /* Implementation Note: For start-domain command, control should go into else clause
>> + * because the start-domain-command code is creating the config context and
>> + * passing it to launcher. In the case of instances and node agents, the
>> + * cached config context is NOT used.
>> + * This is true with changes made to launcher during Oct 2006 - April 2007.
>> + */
>> Domain domain=ConfigAPIHelper.getDomainConfigBean(configCtxt);
>> setDomainName(domain);
>> // get the server's config by name, need it as soon as possible for logging
>> Index: admin/servermgmt/src/java/com/sun/enterprise/admin/servermgmt/pe/PEInstancesManager.java
>> ===================================================================
>> RCS file: /cvs/glassfish/admin/servermgmt/src/java/com/sun/enterprise/admin/servermgmt/pe/PEInstancesManager.java,v
>> retrieving revision 1.13
>> diff -u -w -b -r1.13 PEInstancesManager.java
>> --- admin/servermgmt/src/java/com/sun/enterprise/admin/servermgmt/pe/PEInstancesManager.java 9 Dec 2006 03:45:12 -0000 1.13
>> +++ admin/servermgmt/src/java/com/sun/enterprise/admin/servermgmt/pe/PEInstancesManager.java 11 Apr 2007 00:04:12 -0000
>> @@ -265,6 +265,7 @@
>> else
>> {
>> ASLauncher launcher = new ASLauncher();
>> + launcher.setRefreshConfigContext(_config.getRefreshConfigContext());
>> launcher.preProcess(launcherArgs, envProps);
>> process = launcher.process(launcherArgs, securityInfo);
>> }
>> Index: admin-cli/commands/src/java/com/sun/enterprise/cli/commands/StartDomainCommand.java
>> ===================================================================
>> RCS file: /cvs/glassfish/admin-cli/commands/src/java/com/sun/enterprise/cli/commands/StartDomainCommand.java,v
>> retrieving revision 1.23
>> diff -u -w -b -r1.23 StartDomainCommand.java
>> --- admin-cli/commands/src/java/com/sun/enterprise/cli/commands/StartDomainCommand.java 8 Mar 2007 14:36:48 -0000 1.23
>> +++ admin-cli/commands/src/java/com/sun/enterprise/cli/commands/StartDomainCommand.java 11 Apr 2007 00:04:12 -0000
>> @@ -400,6 +400,7 @@
>> {
>> mgr = getFeatureFactory().getDomainsManager();
>> config = getDomainConfig(domainName);
>> + config.setRefreshConfingContext(false);
>> this.validateDomain();
>> CLILogger.getInstance().printDetailMessage(getLocalizedString("StartingDomain",
>> new Object[] {domainName}));
>>
>>
>> ------------------------------------------------------------------------
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>>
>