Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WFLY-1439 #4579

Closed
wants to merge 1 commit into from
Closed

WFLY-1439 #4579

wants to merge 1 commit into from

Conversation

baranowb
Copy link
Contributor

@baranowb baranowb commented Jun 3, 2013

ServerSetupObserver leaks changes if exception is thrown

https://bugzilla.redhat.com/show_bug.cgi?id=967533

@wildfly-ci
Copy link

Triggering build using a merge of 5d1de3d2cc9719cc8ee2d12492574cd86584ed0c on branch master:
Private: http://lightning.mw.lab.eng.bos.redhat.com/jenkins/job/wildfly-param-pull/

@wildfly-ci
Copy link

Build 7298 is now running using a merge of 5d1de3d2cc9719cc8ee2d12492574cd86584ed0c on branch master:
Private: http://lightning.mw.lab.eng.bos.redhat.com/jenkins/job/wildfly-param-pull/7298

}
}
}

final ManagementClient client = managementClient.get();
try {
for (ServerSetupTask instance : current) {
for (ServerSetupTask instance : setupTasksAll) {
setupTasksInForce.add(instance);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the "setupTasksInForce" supposed to contain the ServerSetupTask(s) whose setup was successfully invoked? If yes, then this:

      setupTasksInForce.add(instance);

should happen after

      instance.setup(....);

has been invoked on the next line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, nope, if code for some reason throws exception, we should give it a chance to do graceul cleanup.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, I don't understand why you need this separate collection at all. The code block here is effectively copying over all of "setupTasksAll" collection into the "setupTasksInForce" collection irrespective of whether or not there's an exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trick is that if "setup" performs N changes and only n-th throws exception for some reason, the n-1 changes need to be reverted, hence the "tearDown" must be called. If "setupTasksInForce.add" happen after "setup", "tearDown" could not be called, hence n-1 changes would still be there.

This could be handled by class level variable which would be used as "index" of last successful setup task, but its more transparent this way, in my opinion.

@jaikiran
Copy link
Contributor

jaikiran commented Jun 3, 2013

Is it just formatting changes to WebCERTTestsSecurityDomainSetup.java? It's better to not include the formatting changes to unaffected lines of code.

@wildfly-ci
Copy link

Build 7298 outcome was SUCCESS using a merge of 5d1de3d2cc9719cc8ee2d12492574cd86584ed0c on branch master:
Private: http://lightning.mw.lab.eng.bos.redhat.com/jenkins/job/wildfly-param-pull/7298
Public: http://hudson.jboss.org/hudson/job/wildfly-param-pull/7298

@wildfly-ci
Copy link

Triggering build using a merge of a71c8ebff8f941b3bf9f62de7ff68bf50a921bfe on branch master:
Private: http://lightning.mw.lab.eng.bos.redhat.com/jenkins/job/wildfly-param-pull/

@wildfly-ci
Copy link

Build 7299 is now running using a merge of a71c8ebff8f941b3bf9f62de7ff68bf50a921bfe on branch master:
Private: http://lightning.mw.lab.eng.bos.redhat.com/jenkins/job/wildfly-param-pull/7299

@wildfly-ci
Copy link

Build 7299 outcome was FAILURE using a merge of a71c8ebff8f941b3bf9f62de7ff68bf50a921bfe on branch master:
Private: http://lightning.mw.lab.eng.bos.redhat.com/jenkins/job/wildfly-param-pull/7299
Public: http://hudson.jboss.org/hudson/job/wildfly-param-pull/7299

setupTasksInForce.get(i).tearDown(client, container.getKey());
} catch (Exception e) {
log.error("Setup task failed during tear down. Offending class '" + setupTasksAll.get(i) + "'", e);
e.printStackTrace();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, CI jobs suggest something different, without this, some setup failures can spawn atleast 50 test failures..

@baranowb
Copy link
Contributor Author

baranowb commented Jun 4, 2013

retest this please

@wildfly-ci
Copy link

Triggering build using a merge of 11a2b0a on branch master:
Private: http://lightning.mw.lab.eng.bos.redhat.com/jenkins/job/wildfly-param-pull/

@wildfly-ci
Copy link

Build 7311 is now running using a merge of 11a2b0a on branch master:
Private: http://lightning.mw.lab.eng.bos.redhat.com/jenkins/job/wildfly-param-pull/7311

@wildfly-ci
Copy link

Build 7311 outcome was SUCCESS using a merge of 11a2b0a on branch master:
Private: http://lightning.mw.lab.eng.bos.redhat.com/jenkins/job/wildfly-param-pull/7311
Public: http://hudson.jboss.org/hudson/job/wildfly-param-pull/7311

@n1hility
Copy link
Member

This looks reasonable

@jaikiran
Copy link
Contributor

Merged

@jaikiran jaikiran closed this Jun 14, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants