Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 530634 - jdk-9_x64-latest produces unexpected console output failing lots of JDT/Core tests
Summary: jdk-9_x64-latest produces unexpected console output failing lots of JDT/Core ...
Status: RESOLVED FIXED
Alias: None
Product: Community
Classification: Eclipse Foundation
Component: CI-Jenkins (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 2018-Q1   Edit
Assignee: CI Admin Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 530366
  Show dependency tree
 
Reported: 2018-02-01 15:20 EST by Stephan Herrmann CLA
Modified: 2018-02-05 16:09 EST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2018-02-01 15:20:36 EST
Lots of gerrit tests in JDT/Core are failing since https://ci.eclipse.org/jdt/job/eclipse.jdt.core-Gerrit/376/ due to unexpected output:
Picked up JAVA_TOOL_OPTIONS: -Xmx2G -Djava.io.tmpdir=/tmp/genie.jdt

This seems to be produced unconditionally from jdk-9_x64-latest/bin/java

(Is that file a script??).
Comment 1 Frederic Gurr CLA 2018-02-01 15:39:33 EST
We added the JAVA_TOOL_OPTIONS environment variable to the systemd start script for Hudson/Jenkins today.
Comment 2 Stephan Herrmann CLA 2018-02-01 15:41:50 EST
(In reply to Frederic Gurr from comment #1)
> We added the JAVA_TOOL_OPTIONS environment variable to the systemd start
> script for Hudson/Jenkins today.

If it's in a systemd start script, how come we see it's output in java applications run from our tests?
Comment 3 Mikaël Barbero CLA 2018-02-02 03:52:29 EST
All JDK output this line when they see the JAVA_TOOL_OPTIONS env variable. Try for yourself on your local machine.
Comment 4 Mikaël Barbero CLA 2018-02-02 05:07:04 EST
You can't prevent java to print this line on stderr. The only way is to unset it. If this is the way you want to go, please make sure that you call your java applications with a given -Xmx and and the same java.io.tmpdir as defined in this variable. 

See 
https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/envvars002.html
https://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html#tooloptions

The reasoning for setting JAVA_TOOL_OPTIONS on the CI instances is to easily prevent java to define on its own the max heap size. By default, it's something like 25% of the machine RAM. CI instances at Eclipse currently runs on machines with 64GB or 128GB of RAM, making the default value way too high for a shared environment. Setting JAVA_TOOL_OPTIONS is our only way to make the default a more sensible one for every single Java process spawned by builds. Making sure that projects actually pass a sensible value is an impossible task otherwise. Of course, any project can decide to override the default value by specifying a different one on the command line.

Thanks.
Comment 5 Stephan Herrmann CLA 2018-02-02 07:22:56 EST
To be explicit: the problematic situation is when the test suite compiles and runs the SUT. Those tiny programs (typically few tens of LOC) are executed as part of the test and the output (std/err) of those programs is checked. Tens of thousands of these per build.

It's not practicable to expect output from Java that is not under our control.

OTOH, I'm not concerned about the environment in which the test suite itself is invoked.

Apparently, JDT is part of 0.1% that need a very extraordinary solution [1]. Interesting.

[1] https://dev.eclipse.org/mhonarc/lists/cross-project-issues-dev/msg15266.html
Comment 6 Mikaël Barbero CLA 2018-02-02 08:25:53 EST
I don’t know how the SUT are started. I guess they use something like ProcrssBuilder. The workaround is then to remove JAVA_TOOL_OPTIONS from the environment map. If you point me to where is the startup code, I cab probably help with a patch.
Comment 8 Jay Arthanareeswaran CLA 2018-02-02 10:23:05 EST
Stephan,

the unset attempt didn't work and then I realized the tests probably run in a different instance or a different VM. Should we try to address this in our code? :(
Comment 9 Eclipse Genie CLA 2018-02-02 11:02:10 EST
New Gerrit change created: https://git.eclipse.org/r/116616
Comment 10 Mikaël Barbero CLA 2018-02-02 11:05:06 EST
https://git.eclipse.org/r/116616 is an initial version of what I see as a workaround. 

Please note that I don't have any dev env set on the current machine, so this code has been written without any compiler / ide. It will certainly not compile.
Comment 12 Stephan Herrmann CLA 2018-02-03 04:15:19 EST
(In reply to Mikaël Barbero from comment #10)
> https://git.eclipse.org/r/116616 is an initial version of what I see as a
> workaround. 
> 
> Please note that I don't have any dev env set on the current machine, so
> this code has been written without any compiler / ide. It will certainly not
> compile.

Nice shot! Only minimal cleanup needed to push this

(In reply to Eclipse Genie from comment #11)
> Gerrit change https://git.eclipse.org/r/116616 was merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/
> ?id=21414b73c99f6c67b090931395d11db67cbb554e

With this our tests pass again.

Thanks, Mikaël!
Comment 13 Eclipse Genie CLA 2018-02-03 12:29:36 EST
New Gerrit change created: https://git.eclipse.org/r/116662
Comment 14 Eclipse Genie CLA 2018-02-03 14:07:22 EST
Gerrit change https://git.eclipse.org/r/116662 was merged to [R4_7_maintenance].
Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=6b020e705ba2669481bde653aefe4e4b18b04efe
Comment 15 Till Brychcy CLA 2018-02-05 08:43:28 EST
The problem exists in jdt.debug, too:

https://ci.eclipse.org/jdt/job/eclipse.jdt.debug-Gerrit/142/testReport/junit/org.eclipse.jdt.debug.tests.core/ArgumentTests/testVMArgSimpleQuotes/

Fehlermeldung
expected:<[]foo> but was:<[Picked up JAVA_TOOL_OPTIONS: -Xmx2G -Djava.io.tmpdir=/tmp/genie.jdt]foo>
Stacktrace
junit.framework.ComparisonFailure: expected:<[]foo> but was:<[Picked up JAVA_TOOL_OPTIONS: -Xmx2G -Djava.io.tmpdir=/tmp/genie.jdt]foo>
	at junit.framework.Assert.assertEquals(Assert.java:100)
	at junit.framework.Assert.assertEquals(Assert.java:107)
	at junit.framework.TestCase.assertEquals(TestCase.java:269)
	at org.eclipse.jdt.debug.tests.core.ArgumentTests.testOutput(ArgumentTests.java:378)
	at org.eclipse.jdt.debug.tests.core.ArgumentTests.testWithVMArg(ArgumentTests.java:309)
	at org.eclipse.jdt.debug.tests.core.ArgumentTests.testVMArgSimpleQuotes(ArgumentTests.java:152)
Comment 16 Eclipse Genie CLA 2018-02-05 12:05:11 EST
New Gerrit change created: https://git.eclipse.org/r/116732
Comment 17 Mikaël Barbero CLA 2018-02-05 12:05:47 EST
(In reply to Eclipse Genie from comment #16)
> New Gerrit change created: https://git.eclipse.org/r/116732

This patch applies a similar fix, but for ILaunch*
Comment 19 Stephan Herrmann CLA 2018-02-05 16:09:08 EST
Fixes applied in JDT/Core and JDT/Debug tests.
Thanks.