eclipse-openj9 / openj9

Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Other
3.29k stars 723 forks source link

sanity.functional_x86-64_windows jdk11,13 cmdLineTester_getPid_0 Access denied #7717

Open AdamBrousseau opened 5 years ago

AdamBrousseau commented 5 years ago

Test doesn't seem to run on jdk8 Last passed jdk11 Aug 8 33b1de73de60067f496ddcb9a71f837b2abdc17b Last passed jdk13 Aug 28 98547b0f469695731da1ba45d7880295e9b195af

Doesn't seem to be machine specific. 100% failure rate. Seeing as this passes externally I would guess it's a machine config difference. Will just need someone to help me figure out what to change.

===============================================
Running test cmdLineTester_getPid_0 ...
===============================================
cmdLineTester_getPid_0 Start Time: Thu Nov  7 00:56:58 2019 Epoch Time (ms): 1573106218135
variation: NoOptions
JVM_OPTIONS: -Xcompressedrefs 
*** Starting test suite: getPid test ***
Testing: Compare RuntimeMXBean.getPid() with getting PID from system
Test start time: 2019/11/07 00:56:59 Eastern Standard Time
Running command: perl C:/Users/jenkins/workspace/Test_openjdk13_j9_sanity.functional_x86-64_windows_Nightly/openjdk-tests///..//jvmtest/functional/cmdLineTests/runtimemxbeanTests/getPidTest.pl "C:/Users/jenkins/workspace/Test_openjdk13_j9_sanity.functional_x86-64_windows_Nightly/openjdkbinary/j2sdk-image\\bin\\java" -Xcompressedrefs  -cp C:/Users/jenkins/workspace/Test_openjdk13_j9_sanity.functional_x86-64_windows_Nightly/openjdk-tests///..//jvmtest/functional/cmdLineTests/runtimemxbeanTests/runtimemxbeanTests.jar GetPid
Time spent starting: 47 milliseconds
Time spent executing: 6641 milliseconds
Test result: FAILED
Output from test:
 [OUT] FAIL: RuntimeMXBean.getPID() returned 652 instead of 
 [ERR] ERROR:
 [ERR] 
 [ERR] Description = Access denied
 [ERR] 
 [ERR] Argument "" isn't numeric in numeric eq (==) at C:/Users/jenkins/workspace/Test_openjdk13_j9_sanity.functional_x86-64_windows_Nightly/openjdk-tests///..//jvmtest/functional/cmdLineTests/runtimemxbeanTests/getPidTest.pl line 58, <GEN1> line 1.
>> Success condition was not found: [Output match: PASS]
>> Failure condition was found: [Output match: FAIL]

---TEST RESULTS---
Number of PASSED tests: 0 out of 1
Number of FAILED tests: 1 out of 1

---SUMMARY OF FAILED TESTS---
Compare RuntimeMXBean.getPid() with getting PID from system
JasonFengJ9 commented 5 years ago

https://github.com/eclipse/openj9/pull/1638 https://github.com/eclipse/openj9/issues/1630

pshipton commented 5 years ago

Seems perl can't get the pid https://github.com/eclipse/openj9/blob/59fcbec6f4c42e5781d7f2cbb3baa4d14cbd0557/test/functional/cmdLineTests/runtimemxbeanTests/getPidTest.pl#L41

AdamBrousseau commented 5 years ago

All external machines are win2012r2. All internal are win2016. Created a win2012r2 internally and reran a grinder on it and it passed.

AdamBrousseau commented 5 years ago

Jason and I did a bit of digging and that line41 is the correct line that is failing. So this issue is a Perl (test) problem not a Java problem. Running java -cp runtimemxbeanTests.jar GetPid works.

AdamBrousseau commented 5 years ago

Seems to be a permissions issue as that wmic command works with the Admin user. Digging through Microsoft docs to try and figure out what needs to be changed.

AdamBrousseau commented 5 years ago

This works on our Fyre machines but not our vSphere machines. Struggling to find the right setting to change or what is different about the 2 sets of machines.

AdamBrousseau commented 5 years ago
AdamBrousseau commented 5 years ago

Pretty sure this issue and #7716 are same root cause. Permissions issues when running via cygwin-ssh. Haven't been able to find the cause yet but getting closer. Both issues are resolved by rdp-ing into the machine and running the command by hand using the same jenkins user.

AdamBrousseau commented 5 years ago

I'll copy this entire comment into #7716

Root cause: Newer version of OpenSSH (7.9->8.0 see changelog [1], Portability section), which is installed during machine & Cygwin setup, has changes to the setup which further restrict the configuration and resulting default permissions. Specifically, the process now runs as SYSTEM user instead of an added cyg_server user (see now outdated setup instructions in [2]). Which has the effect of cascading less permissions down to the jenkins user when logged in via cygwin/ssh. Jenkins no longer has (by default) access to run WMI/WMIC or query the system for swap space (memory info). The "fix" is to give more permissions to the jenkins user.

To resolve #7716 getTotalSwapSpaceSize() API returned -1

To resolve this issue (#7717) getPID() returned Access Deined

The following settings are required in order to allow jenkins remote access to WMI:

Refs
  1. https://www.openssh.com/releasenotes.html
    * sshd(8): On Cygwin, run as SYSTEM where possible, using S4U for
    token creation if it supports MsV1_0 S4U Logon.
  2. https://docs.cloudbees.com/docs/cloudbees-jenkins-enterprise/latest/admin-guide/agents#_microsoft_windows
  3. From a Cygwin64 Terminal launched to run as an Administrator run the ssh-host-config script:
  4. Provide the following answers: a. Should StrictModes be used: yes b. Should privilege separation be used: yes c. new local account 'sshd': yes d. Do you want to install sshd as a service: yes e. Enter the value of CYGWIN for the daemon: f. Do you want to use a different name: no g. Create new privileged user account 'WIN-…​\cyg_server' (Cygwin name: 'cyg_server'): yes h. Please enter the password: (you will need to provide a password)
AdamBrousseau commented 5 years ago

Since this wmi tool is being used by test we should probably add Doc to the requirements about this use case cc @smlambert