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

8295164: JDK 8 jdi tests should not use tasklist command on Windows #133

Closed
wants to merge 2 commits into from

Conversation

zzambers
Copy link
Contributor

@zzambers zzambers commented Oct 11, 2022

Shell jdi tests are currently failing on windows. These tests are part of jdk_tier1.

Problem:
Tests fail because ShellScaffold.sh uses (native) tasklist command to check if process with given PID is alive. However this no longer works, since PIDs by Cygwin/Msys2 are no longer same as native Windows PIDs [1][2].

Solution:
Fixed by switching to ps command. Original comment says tasklist was used due to ps sometimes missing some processes. This could be because ps, by default, only shows cygwin processes. I added -W argument to also show native windows processes [3] and I have seen no problems. Fix is targeted for JDK8, since newer JDKs migrated to java based tests (in several steps [4][5][6][7]...), but i think backporting all of that work, just to fix this issue would be overkill. (However nothing prevents anyone from doing so in the future, if desired.)

Testing:
With this fix jdk_tier1 passes for me on Windows.

[1] msys2/MSYS2-packages#1724
[2] https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=b5e1003722cb14235c4f166be72c09acdffc62ea
[3] https://www.cygwin.com/cygwin-ug-net/ps.html
[4] https://bugs.openjdk.org/browse/JDK-8209109
[5] https://bugs.openjdk.org/browse/JDK-8209604
[6] https://bugs.openjdk.org/browse/JDK-8210243
[7] https://bugs.openjdk.org/browse/JDK-8210760


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8295164: JDK 8 jdi tests should not use tasklist command on Windows

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk8u-dev pull/133/head:pull/133
$ git checkout pull/133

Update a local copy of the PR:
$ git checkout pull/133
$ git pull https://git.openjdk.org/jdk8u-dev pull/133/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 133

View PR using the GUI difftool:
$ git pr show -t 133

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk8u-dev/pull/133.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 11, 2022

👋 Welcome back zzambers! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 11, 2022
@mlbridge
Copy link

mlbridge bot commented Oct 11, 2022

Webrevs

@jerboaa
Copy link
Contributor

jerboaa commented Oct 12, 2022

@zzambers Shouldn't this also enable windows tier1 tests on GHA?

@zzambers
Copy link
Contributor Author

zzambers commented Oct 12, 2022

@jerboaa, I planned to do separate PR to enable windows jdk_tier1 in GHA. Should I add it to this PR?

@jerboaa
Copy link
Contributor

jerboaa commented Oct 12, 2022

It would make sense to add it here, since it would show what you say (i.e. that it's passing now)

@zzambers zzambers changed the title 8295164: JDK8 jdi tests should not use tasklist command on Windows 8295164: JDK 8 jdi tests should not use tasklist command on Windows Oct 12, 2022
@zzambers
Copy link
Contributor Author

zzambers commented Oct 12, 2022

Interesting, one test failed on Windows x64. I have not seen this failure before (when testing this change).

TEST: com/sun/jdi/DoubleAgentTest.java

java.lang.Exception: Debuggee does not have ERROR in the output: EError occurred during initialization of VM
agent library failed to initRROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.
: jdwp

	at DoubleAgentTest.main(DoubleAgentTest.java:146)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:298)
	at java.lang.Thread.run(Thread.java:750)

JavaTest Message: Test threw exception: java.lang.Exception
JavaTest Message: shutting down test

It is failure of jdi test, but not shell one, and it does not seem related to bug being fixed by this PR. Looks like output got interleaved as result of race condition. Actually this is most probably result of bad design of that particular test, where stdout and stderr are being concurrently collected into single string field named "outputText" [1]. Seems like word "ERROR" got split by text from the other stream, resulting in test failure [2]. Bad luck that "ERROR" word got split :) , but test should definitely be fixed (I'll look at that later).

[1]


[2]
if ( !outputText.contains("ERROR") ) {

@zzambers
Copy link
Contributor Author

I'll try to reschedule tests to see, what happens.

@zzambers
Copy link
Contributor Author

Ok, all tests passed this time. I'll keep this PR as it is and deal with that racy sporadically failing test in another PR.

Copy link
Contributor

@jerboaa jerboaa left a comment

Choose a reason for hiding this comment

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

This looks fine to me. Thanks for doing this.

@openjdk
Copy link

openjdk bot commented Oct 13, 2022

@zzambers This change now passes all automated pre-integration checks.

After integration, the commit message for the final commit will be:

8295164: JDK 8 jdi tests should not use tasklist command on Windows

Also enable jdk_tier1 GHA tests on Windows

Reviewed-by: sgehwolf

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 3 new commits pushed to the master branch:

  • 05b249d: 8253702: BigSur version number reported as 10.16, should be 11.nn
  • 861ac32: 8293828: JFR: jfr/event/oldobject/TestClassLoaderLeak.java still fails when GC cycles are not happening
  • 4a25b00: 8274563: jfr/event/oldobject/TestClassLoaderLeak.java fails when GC cycles are not happening

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@jerboaa) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 13, 2022
@jerboaa
Copy link
Contributor

jerboaa commented Oct 13, 2022

/summary Also enable jdk_tier1 GHA tests on Windows

@openjdk
Copy link

openjdk bot commented Oct 13, 2022

@jerboaa Only the author (@zzambers) is allowed to issue the /summary command.

@jerboaa
Copy link
Contributor

jerboaa commented Oct 13, 2022

@zzambers Please add the summary. Thanks!

@zzambers
Copy link
Contributor Author

/summary Also enable jdk_tier1 GHA tests on Windows

@openjdk
Copy link

openjdk bot commented Oct 13, 2022

@zzambers Setting summary to Also enable jdk_tier1 GHA tests on Windows

@zzambers
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Oct 13, 2022
@openjdk
Copy link

openjdk bot commented Oct 13, 2022

@zzambers
Your change (at version 959a2f3) is now ready to be sponsored by a Committer.

@zzambers
Copy link
Contributor Author

@jerboaa Thanks

@jerboaa
Copy link
Contributor

jerboaa commented Oct 13, 2022

/sponsor

@openjdk
Copy link

openjdk bot commented Oct 13, 2022

Going to push as commit 8280a89.
Since your change was applied there have been 3 commits pushed to the master branch:

  • 05b249d: 8253702: BigSur version number reported as 10.16, should be 11.nn
  • 861ac32: 8293828: JFR: jfr/event/oldobject/TestClassLoaderLeak.java still fails when GC cycles are not happening
  • 4a25b00: 8274563: jfr/event/oldobject/TestClassLoaderLeak.java fails when GC cycles are not happening

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 13, 2022
@openjdk openjdk bot closed this Oct 13, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 13, 2022
@openjdk openjdk bot removed the sponsor Pull request is ready to be sponsored label Oct 13, 2022
@openjdk
Copy link

openjdk bot commented Oct 13, 2022

@jerboaa @zzambers Pushed as commit 8280a89.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
2 participants