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-2640] Unable to add cached-connection-manager after removing it once #9206

Merged
merged 1 commit into from Jan 17, 2017

Conversation

iweiss
Copy link
Contributor

@iweiss iweiss commented Sep 20, 2016

@iweiss iweiss changed the title WFLY-2640 [WFLY-2640] Unable to add cached-connection-manager after removing it once Sep 20, 2016
<xs:annotation>
<xs:documentation>
Cached connection manager settings for resource adapters. NOTE: This service is always available so there's no
way to remove it.
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 why is it represented in the xsd?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because you can actually configure it. My suggestion would be to change minOccurs to 1, but since that requires a schema change I don't know if this issue is the best one to do this.

Copy link
Contributor

Choose a reason for hiding this comment

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

@bstansberry are you ok with this now?

@kabir kabir added JBEAP hold PR should not be merged for some reason. labels Sep 23, 2016
@bstansberry
Copy link
Contributor

Sorry for the delay in digging into this. And for the wall of text to follow. ;)

First, this CCM stuff is an odd case so it's good to improve it along these lines. So no basic objection.

But, FWIW the general condition described in WFLY-2640 can be found all over the place in WildFly and we shouldn't be jumping through hoops doing one-off fixes for them. IOW I'm not much bothered by people removing a resource, getting a reload-required as part of the response to that reload, and then having an issue adding it back when they don't do the reload first.

Well, I am bothered but the general solution is to declare the resource to provides a capability and then the WFCORE-1106 magic will handle it for you. (Read that JIRA for details.)

Ok, now about this specific PR.

First, making the add handler private is fine. Invoking it after boot never worked. So there is no incompatible change involved there. And not worth it IMO to bump the subsystem API version to correct a bug. This alone solves the JIRA by making it illegal to do the add.

Next, making the remove handler private is an incompatible API change. The remove handler did actually work, just in an odd way.

What it did, in terms of its practical effect, was the same as if it had undefined all the attributes in the resource, except 'install' which it set to 'false', and then triggered reload-required.

So, we should replace the handler for the 'remove' operation with one that specifically does that. This way after the user does the 'remove' but before the reload, the model reflects the actual configured state, as opposed to inaccurately pretending the config has no resource at all.

If you don't want to support 'remove' going forward, add deprecation metadata to its definition so it logs the deprecation warning. And then we can remove it in some future release.

I don't see any need to discuss this 'remove' behavior in the xsd documentation.

The minOccurs should not be 1 in the xsd. The element isn't actually required, and it's presence or absence is actually meaningful. If present, the 'install' attribute in the resource is 'true', otherwise it is 'false'.

@iweiss
Copy link
Contributor Author

iweiss commented Sep 30, 2016

@bstansberry Would this do?

I tested it locally and the install state is persisted as expected.

@wildfly-ci
Copy link

Windows Build 5529 outcome was FAILURE using a merge of bf084ad
Summary: Tests failed: 1 (1 new), passed: 3459, ignored: 192 Build time: 01:20:45

Failed tests

org.jboss.as.test.integration.domain.mixed.eap640.MixedDomainDeployment640TestCase: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: Could not start container
    at org.jboss.as.test.integration.domain.management.util.DomainLifecycleUtil.awaitServers(DomainLifecycleUtil.java:449)
    at org.jboss.as.test.integration.domain.management.util.DomainLifecycleUtil.start(DomainLifecycleUtil.java:251)
    at org.jboss.as.test.integration.domain.mixed.MixedDomainTestSupport.startAndAdjust(MixedDomainTestSupport.java:175)
    at org.jboss.as.test.integration.domain.mixed.MixedDomainTestSupport.start(MixedDomainTestSupport.java:93)
    at org.jboss.as.test.integration.domain.mixed.MixedDomainTestSuite.getSupport(MixedDomainTestSuite.java:96)
    at org.jboss.as.test.integration.domain.mixed.MixedDomainTestSuite.getSupport(MixedDomainTestSuite.java:59)
    at org.jboss.as.test.integration.domain.mixed.eap640.MixedDomain640TestSuite.initializeDomain(MixedDomain640TestSuite.java:44)
    at org.jboss.as.test.integration.domain.mixed.eap640.MixedDomainDeployment640TestCase.beforeClass(MixedDomainDeployment640TestCase.java:38)
------- Stdout: -------
12:59:44,504 INFO  [org.jboss.modules] (main) JBoss Modules version 1.6.0.Beta3
12:59:44,920 INFO  [org.jboss.as.process.Host Controller.status] (main) WFLYPC0018: Starting process 'Host Controller'
[Host Controller] 12:59:45,406 INFO  [org.jboss.modules] (main) JBoss Modules version 1.6.0.Beta3
[Host Controller] 12:59:45,753 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.7.Final
[Host Controller] 12:59:45,817 INFO  [org.jboss.as] (MSC service thread 1-7) WFLYSRV0049: WildFly Full 11.0.0.Alpha1-SNAPSHOT (WildFly Core 3.0.0.Alpha9) starting
[Host Controller] 12:59:46,407 INFO  [org.jboss.as.domain.management] (Controller Boot Thread) WFLYDM0136: Registered OpenSSL provider
[Host Controller] 12:59:46,662 INFO  [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'permgen-size' in the resource at address '/host=master/jvm=default' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
[Host Controller] 12:59:46,663 INFO  [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'max-permgen-size' in the resource at address '/host=master/jvm=default' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
[Host Controller] 12:59:46,697 INFO  [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0003: Creating http management service using network interface (management) port (9990) securePort (-1)
[Host Controller] 12:59:46,700 INFO  [org.xnio] (MSC service thread 1-2) XNIO version 3.4.0.Final
[Host Controller] 12:59:46,705 INFO  [org.xnio.nio] (MSC service thread 1-2) XNIO NIO Implementation Version 3.4.0.Final
[Host Controller] 12:59:46,723 INFO  [org.jboss.as.patching] (MSC service thread 1-5) WFLYPAT0050: WildFly Full cumulative patch ID is: base, one-off patches include: none
[Host Controller] 12:59:46,741 WARN  [org.jboss.as.domain.management.security] (MSC service thread 1-7) WFLYDM0111: Keystore C:\BuildAgent\work\a31d203e70e89f90\testsuite\mixed-domain\target\domains\MixedDomain640TestSuite\master\configuration\application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost
[Host Controller] 12:59:46,747 INFO  [org.jboss.remoting] (MSC service thread 1-2) JBoss Remoting version 4.0.21.Final
[Host Controller] 12:59:46,769 INFO  [org.jboss.as.remoting] (MSC service thread 1-3) WFLYRMT0001: Listening on [::1]:9999
[Host Controller] 12:59:47,928 INFO  [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/profile=default/subsystem=undertow/server=default-server/https-listener=https' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
[Host Controller] 12:59:47,967 INFO  [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/profile=ha/subsystem=undertow/server=default-server/https-listener=https' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
[Host Controller] 12:59:48,097 INFO  [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/profile=full/subsystem=undertow/server=default-server/https-listener=https' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
[Host Controller] 12:59:48,131 INFO  [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/profile=full-ha/subsystem=undertow/server=default-server/https-listener=https' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
[Host Controller] 12:59:48,669 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://[::1]:9990/management
[Host Controller] 12:59:48,669 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0054: Admin console is not enabled
[Host Controller] 12:59:48,669 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 11.0.0.Alpha1-SNAPSHOT (WildFly Core 3.0.0.Alpha9) (Host Controller) started in 3647ms - Started 48 of 52 services (18 services are lazy, passive or on-demand)
INFO  [org.jboss.as.test.integration.domain.management.util.DomainLifecycleUtil] HostController started in 5061 ms
[Host Controller] 12:59:51,242 WARN  [org.jboss.as.messaging] (management-handler-thread - 2) WFLYMSG0071: There is no resource matching the expiry-address jms.queue.ExpiryQueue for the address-settings #, expired messages from destinations matching this address-setting will be lost!
[Host Controller] 12:59:51,243 WARN  [org.jboss.as.messaging] (management-handler-thread - 2) WFLYMSG0072: There is no resource matching the dead-letter-address jms.queue.DLQ for the address-settings #, undelivered messages from destinations matching this address-setting will be lost!
[Host Controller] 12:59:52,840 INFO  [org.jboss.as.controller.management-deprecated] (management-handler-thread - 1) WFLYCTL0028: Attribute 'default-stack' in the resource at address '/' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
[Host Controller] 12:59:53,774 INFO  [org.jboss.as.controller.management-deprecated] (management-handler-thread - 2) WFLYCTL0028: Attribute 'stack' in the resource at address '/' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
[Host Controller] 12:59:53,917 INFO  [org.jboss.as] (MSC service thread 1-7) WFLYSRV0050: WildFly Full 11.0.0.Alpha1-SNAPSHOT (WildFly Core 3.0.0.Alpha9) stopped in 24ms
[Host Controller] 12:59:53,918 INFO  [org.jboss.as] (MSC service thread 1-7) WFLYSRV0049: WildFly Full 11.0.0.Alpha1-SNAPSHOT (WildFly Core 3.0.0.Alpha9) starting
[Host Controller] 12:59:53,951 INFO  [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'permgen-size' in the resource at address '/host=master/jvm=default' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
[Host Controller] 12:59:53,953 INFO  [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'max-permgen-size' in the resource at address '/host=master/jvm=default' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
[Host Controller] 12:59:53,959 INFO  [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0003: Creating http management service using network interface (management) port (9990) securePort (-1)
[Host Controller] 12:59:53,968 INFO  [org.jboss.as.patching] (MSC service thread 1-6) WFLYPAT0050: WildFly Full cumulative patch ID is: base, one-off patches include: none
[Host Controller] 12:59:53,970 WARN  [org.jboss.as.domain.management.security] (MSC service thread 1-1) WFLYDM0111: Keystore C:\BuildAgent\work\a31d203e70e89f90\testsuite\mixed-domain\target\domains\MixedDomain640TestSuite\master\configuration\application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost
[Host Controller] 12:59:54,014 INFO  [org.jboss.as.remoting] (MSC service thread 1-4) WFLYRMT0001: Listening on [::1]:9999
[Host Controller] 12:59:54,202 INFO  [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'default-stack' in the resource at address '/profile=full-ha/subsystem=jgroups' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
[Host Controller] 12:59:54,458 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://[::1]:9990/management
[Host Controller] 12:59:54,459 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://[::1]:9990
[Host Controller] 12:59:54,460 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 11.0.0.Alpha1-SNAPSHOT (WildFly Core 3.0.0.Alpha9) (Host Controller) started in 540ms - Started 48 of 52 services (18 services are lazy, passive or on-demand)
12:59:55,257 INFO  [org.jboss.modules] (main) JBoss Modules version 1.3.6.Final-redhat-1
12:59:55,402 INFO  [org.jboss.as.process.Host Controller.status] (main) JBAS012017: Starting process 'Host Controller'


/**
* @author <a href="ingo@redhat.com">Ingo Weiss</a>
*/
class CachedConnectionManagerRemove extends AbstractRemoveStepHandler {
Copy link
Contributor

Choose a reason for hiding this comment

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

This probably shouldn't be an extension of any standard remove step handler, as it's very custom. See the last commit on https://github.com/bstansberry/wildfly/commits/pullRequest9206 for how the handler should look. Sorry; I should have provided that right off. I wasn't thinking about how custom this is.

protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {

// We need to undefine any parameters and then set install to false, basically resetting the CCM settings
model.get(JcaCachedConnectionManagerDefinition.CcmParameters.DEBUG.getAttribute().getName()).set(ModelType.UNDEFINED);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just an FYI, this does not set the node to 'undefined', i.e. node.isDefined() would return 'true'. Rather, it sets the node value to the ModelType enum UNDEFINED.

A ModelNode can have a ModelType as its value. This is one of the things that allows us to describe the management API solely using ModelNode, e.g. we can describe the type of an attribute as ModelType.BOOLEAN etc.

If you want to make a node undefined, use either node.clear() or node.set(new ModelNode()).

@kabir
Copy link
Contributor

kabir commented Nov 11, 2016

@iweiss in case you've not seen Brian's comments

@iweiss
Copy link
Contributor Author

iweiss commented Nov 14, 2016

@kabir It totally slipped. Sorry. I tried @bstansberry's change and it triggers a loop at org.jboss.as.connector.subsystems.complextestcases.ComplexJcaSubsystemTestCase. I'm trying to understand/identify why this is happening.

@iweiss iweiss force-pushed the WFLY-2640 branch 2 times, most recently from 70c0644 to 022d64a Compare November 18, 2016 14:50
@iweiss
Copy link
Contributor Author

iweiss commented Nov 18, 2016

@kabir This is done now but can only be merged WildFly upgrades WildFly-Core to 3.0.0.Alpha13 due to wildfly/wildfly-core#1953

@kabir kabir added the core-upgrade-needed PR requires a wildfly-core change to be merged and integrated first label Nov 21, 2016
@kabir
Copy link
Contributor

kabir commented Jan 17, 2017

Retest this please

@kabir kabir merged commit 684d3a1 into wildfly:master Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-upgrade-needed PR requires a wildfly-core change to be merged and integrated first hold PR should not be merged for some reason.
Projects
None yet
5 participants