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

[WFCORE-5241] in jboss-cli.sh enclose the JAVA_OPTS with double quote to escape whitespace #4452

Merged
merged 1 commit into from
Mar 1, 2021

Conversation

soul2zimate
Copy link
Contributor

Issue: https://issues.redhat.com/browse/WFCORE-5241
[WFCORE-5241] in jboss-cli.sh enclose the JAVA_OPTS with double quote to escape whitespace

@github-actions github-actions bot added the deps-ok Dependencies have been checked, and there are no significant changes label Jan 8, 2021
@soul2zimate
Copy link
Contributor Author

hmmm. please HOLD. There are test failures from CliScriptTestCase

@jfdenise
Copy link
Contributor

jfdenise commented Jan 8, 2021

@soul2zimate , yes I approved too quickly...JAVA_OPTS is expected to contain multiple argument, and we can't ignore these white spaces.

@jmesnil jmesnil added the hold Do not merge this PR label Jan 11, 2021
@soul2zimate
Copy link
Contributor Author

soul2zimate commented Jan 11, 2021

OK, so the test failed due to spaces between arguments in JAVA_OPTS when it get double quoted.
If exec must be used here, IMHO one possible way to fix this is splitting the JAVA_OPTS into an array (based on some extra function and regex), then double quote every single parameter instead of the whole JAVA_OPTS string.

@jfdenise
Copy link
Contributor

@soul2zimate , I think that we need to keep exec. That has allowed us to resist to CLI script being patched during patch execution.

@soul2zimate
Copy link
Contributor Author

I have updated the PR to convert JAVA_OPTS to an array in order to quote each element, the CI seem good now.

@jfdenise
Copy link
Contributor

script.start(MAVEN_JAVA_OPTS, "--commands=embed-server,:read-attribute(name=server-state),exit");
Map<String, String> env = new LinkedHashMap<>(MAVEN_JAVA_OPTS);
// https://issues.redhat.com/browse/WFCORE-5241 Test with JAVA_OPTS parameter including whitespace
env.put("JAVA_OPTS", "-Dtestparameter=\"something with space\"");
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmmm, that didn't show at local run. I reckon teamcity have something more configured than my local one.
I pushed an update to check any existing JAVA_OPTS first.

@wildfly-ci
Copy link

Core - Full Integration Build 10261 outcome was FAILURE using a merge of d6aa433
Summary: Tests failed: 1 (1 new), passed: 7131, ignored: 113 Build time: 03:03:51

Failed tests

org.jboss.as.test.clustering.cluster.singleton.SingletonDeploymentJBossAllTestCase.test: java.lang.AssertionError: expected:<200> but was:<404>
	at org.jboss.as.test.clustering.cluster.singleton.SingletonDeploymentTestCase.test(SingletonDeploymentTestCase.java:130)
------- Stdout: -------
Warning! The CLI is running in a non-modular environment and cannot load commands from management extensions.
 [0m04:32:38,442 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-6) WFLYJCA0010: Unbound data source [java:jboss/datasources/ExampleDS]
 [0m [0m04:32:38,442 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-6) WFLYMAIL0002: Unbound mail session [java:jboss/mail/Default]
 [0m [0m04:32:38,448 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0008: Undertow HTTPS listener https suspending
 [0m [0m04:32:38,448 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0008: Undertow AJP listener ajp suspending
 [0m [0m04:32:38,453 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0007: Undertow HTTPS listener https stopped, was bound to [::1]:8443
 [0m [0m04:32:38,455 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0007: Undertow AJP listener ajp stopped, was bound to [::1]:8009
 [0m [0m04:32:38,456 INFO  [org.jboss.modcluster] (ServerService Thread Pool -- 8) MODCLUSTER000002: Initiating mod_cluster shutdown
 [0m [0m04:32:38,456 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) WFLYJCA0019: Stopped Driver service with driver-name = h2
 [0m [0m04:32:38,457 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0019: Host default-host stopping
 [0m [0m04:32:38,463 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0008: Undertow HTTP listener default suspending
 [0m [0m04:32:38,463 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0007: Undertow HTTP listener default stopped, was bound to [::1]:8080
 [0m [0m04:32:38,463 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0004: Undertow 2.2.3.Final stopping
 [0m [33m04:32:38,464 WARN  [org.jboss.modcluster] (ServerService Thread Pool -- 8) MODCLUSTER000033: Failed to interrupt socket reception.: java.io.IOException: Invalid argument (sendto failed)
	at java.net.PlainDatagramSocketImpl.send(Native Method)
	at java.net.DatagramSocket.send(DatagramSocket.java:693)
	at org.jboss.modcluster.advertise.impl.AdvertiseListenerImpl.interruptDatagramReader(AdvertiseListenerImpl.java:197)
	at org.jboss.modcluster.advertise.impl.AdvertiseListenerImpl.stop(AdvertiseListenerImpl.java:212)
	at org.jboss.modcluster.advertise.impl.AdvertiseListenerImpl.destroy(AdvertiseListenerImpl.java:224)
	at org.jboss.modcluster.ModClusterService.shutdown(ModClusterService.java:198)
	at org.wildfly.extension.mod_cluster.ContainerEventHandlerServiceConfigurator.accept(ContainerEventHandlerServiceConfigurator.java:83)
	at org.wildfly.extension.mod_cluster.ContainerEventHandlerServiceConfigurator.accept(ContainerEventHandlerServiceConfigurator.java:50)
	at org.wildfly.clustering.service.FunctionalService.stop(FunctionalService.java:73)
	at org.wildfly.clustering.service.AsyncServiceConfigurator$AsyncService.lambda$stop$1(AsyncServiceConfigurator.java:142)
	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
	at java.lang.Thread.run(Thread.java:748)
	at org.jboss.threads.JBossThread.run(JBossThread.java:513)

 [0m [0m04:32:38,489 INFO  [org.jboss.as] (MSC service thread 1-7) WFLYSRV0050: WildFly Full 23.0.0.Beta1-SNAPSHOT (WildFly Core 14.0.1.Final-SNAPSHOT) stopped in 53ms
 [0m [0m04:32:38,490 INFO  [org.jboss.as] (MSC service thread 1-3) WFLYSRV0049: WildFly Full 23.0.0.Beta1-SNAPSHOT (WildFly Core 14.0.1.Final-SNAPSHOT) starting
 [0m [0m04:32:38,586 INFO  [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/core-service=management/management-interface=http-interface' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
 [0m [0m04:32:38,614 INFO  [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 40) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/subsystem=undertow/server=default-server/https-listener=https' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
 [0m [0m04:32:38,620 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
 [0m [0m04:32:38,644 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 47) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.4)
 [0m [0m04:32:38,694 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 56) WFLYCLINF0001: Activating Infinispan subsystem.
 [0m [0m04:32:38,704 INFO  [org.wildfly.extension.health] (ServerService Thread Pool -- 55) WFLYHEALTH0001: Activating Base Health Subsystem
 [0m [0m04:32:38,706 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 57) WFLYIO001: Worker 'default' has auto-configured to 8 IO threads with 64 max task threads based on your 4 available processors
 [0m [0m04:32:38,717 INFO  [org.jboss.as.jaxrs] (ServerService Thread Pool -- 58) WFLYRS0016: RESTEasy version 3.14.0.Final
 [0m [0m04:32:38,722 INFO  [org.jboss.as.ejb3] (MSC service thread 1-8) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 64 (per class), which is derived from thread worker pool sizing.
 [0m [0m04:32:38,723 INFO  [org.jboss.as.ejb3] (MSC service thread 1-8) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 16 (per class), which is derived from the number of CPUs on this host.
 [0m [0m04:32:38,725 INFO  [org.jboss.as.connector] (MSC service thread 1-6) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar @VERSION@)
 [0m [0m04:32:38,736 INFO  [org.jboss.as.clustering.jgroups] (ServerService Thread Pool -- 61) WFLYCLJG0001: Activating JGroups subsystem. JGroups version 4.2.10
 [0m [0m04:32:38,742 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) WFLYJCA0018: Started Driver service with driver-name = h2
 [0m [33m04:32:38,742 WARN  [org.wildfly.extension.elytron] (MSC service thread 1-3) WFLYELY00023: KeyStore file '/store/work/tc-work/37b47ae8b9c60325/full/testsuite/integration/clustering/target/wildfly-1/standalone/configuration/application.keystore' does not exist. Used blank.
 [0m [33m04:32:38,742 WARN  [org.wildfly.extension.elytron] (MSC service thread 1-8) WFLYELY01084: KeyStore /store/work/tc-work/37b47ae8b9c60325/full/testsuite/integration/clustering/target/wildfly-1/standalone/configuration/application.keystore not found, it will be auto generated on first use with a self-signed certificate for host localhost


@soul2zimate
Copy link
Contributor Author

OK, Windows - JDK 11 result gives some weird outputs for CliScriptTestCase.testBatchScript

java.lang.IllegalArgumentException: Unexpected content following the DMR stream
	at org.jboss.dmr.stream.ModelReaderImpl.next(ModelReaderImpl.java:627)
	at org.jboss.dmr.ModelNodeFactory.readFrom(ModelNodeFactory.java:86)
	at org.jboss.dmr.ModelNodeFactory.readFrom(ModelNodeFactory.java:67)
	at org.jboss.dmr.ModelNodeFactory.readFrom(ModelNodeFactory.java:72)
	at org.jboss.dmr.ModelNode.fromString(ModelNode.java:1715)
	at org.wildfly.scripts.test.CliScriptTestCase.testScript(CliScriptTestCase.java:77)
	at org.wildfly.scripts.test.ScriptTestCase.executeTests(ScriptTestCase.java:157)
	at org.wildfly.scripts.test.ScriptTestCase.testBatchScript(ScriptTestCase.java:104)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.apache.maven.surefire.junitcore.JUnitCore.run(JUnitCore.java:55)
	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:137)
	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:107)
	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:83)
	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:75)
	at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:158)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)

However, I don't have a Windows box to debug it. As the fix only applies to jboss-cli.sh, I excluded the test for Windows.

@jfdenise
Copy link
Contributor

@soul2zimate thank-you. @jmesnil , you can remove the hold label.

… each element to allow exec them with whitespace inside
@bstansberry bstansberry removed the hold Do not merge this PR label Feb 19, 2021
@jmesnil jmesnil merged commit 72682c3 into wildfly:master Mar 1, 2021
@jmesnil
Copy link
Member

jmesnil commented Mar 1, 2021

@soul2zimate thanks

@soul2zimate soul2zimate deleted the WFCORE-5241 branch March 1, 2021 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deps-ok Dependencies have been checked, and there are no significant changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants