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

8317287: [macos14] InterJVMGetDropSuccessTest.java: Child VM: abnormal termination #16396

Closed
wants to merge 11 commits into from

Conversation

songpv-imt
Copy link
Contributor

@songpv-imt songpv-imt commented Oct 27, 2023

The root cause of the bug is because mousePress() method is invoked before mouseMove() event is completely processed causing the drag & drop behavior not being able to be recognized properly. This in turn makes the method dragSourceListener.isDropFinished() returns false and fail the test. To fix this, setAutoWaitForIdle(true) and Thread.Sleep is called to make sure the mouseMove() event is processed completely before moving to execute the mousePress() method.

JBS issue: JDK-8317287


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-8317287: [macos14] InterJVMGetDropSuccessTest.java: Child VM: abnormal termination (Bug - P3)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16396/head:pull/16396
$ git checkout pull/16396

Update a local copy of the PR:
$ git checkout pull/16396
$ git pull https://git.openjdk.org/jdk.git pull/16396/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 16396

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16396.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 27, 2023

👋 Welcome back songpv-imt! 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 27, 2023
@openjdk
Copy link

openjdk bot commented Oct 27, 2023

@songpv-imt The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the client client-libs-dev@openjdk.org label Oct 27, 2023
@mlbridge
Copy link

mlbridge bot commented Oct 27, 2023

@songpv-imt
Copy link
Contributor Author

/reviewer credit @shurymury

@openjdk
Copy link

openjdk bot commented Oct 27, 2023

@songpv-imt
Reviewer shurailine successfully credited.

@openjdk
Copy link

openjdk bot commented Nov 7, 2023

@songpv-imt Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information.

@openjdk
Copy link

openjdk bot commented Nov 7, 2023

@songpv-imt Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information.

Based on description in Chapter "17.4 Memory Model", and specifically chapter "17.4.5 Happens-before Order" of the "The Java® Language Specification", DragSourceDropListener.finished field is accessed from two threads without proper synchronization which may also be possible causing the test to fail. Hence, putting code accessing to DragSourceDropListener.finished into a proper synchronization code block.
Copy link
Contributor

@prrace prrace left a comment

Choose a reason for hiding this comment

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

Subsequent to submitting a job to verifying this, I've no objection to stability fixes but from what I saw on macOS 14.0 this failed because of some macOS 14 event delivery changes which have been resolved in macOS 14.1

@songpv-imt
Copy link
Contributor Author

Subsequent to submitting a job to verifying this, I've no objection to stability fixes but from what I saw on macOS 14.0 this failed because of some macOS 14 event delivery changes which have been resolved in macOS 14.1

Thank you for pointing out the BUTTON1_DOWN_MASK field. I have made the suggested changes. Regarding the issue described in the bug, based on my tests, without the code fix, it actually happens on both macOS 14 and 14.1.

Instead of using SYNC_LOCK to synchronize accessing the listener's fields, for better code transparency, we have placed the code that accesses the listener's fields from the main thread into the AWT Event Queue.
@songpv-imt
Copy link
Contributor Author

Hmm... Are you suggesting instead of using SYNC_LOCK, for better code transparency, we should place the code that accesses the listener's fields from the main thread into AWT Event Queue with EventQueue.invokeAndWait? Can you please check if the update code meets your suggestion? Thanks.

@shurymury
Copy link
Contributor

Hmm... Are you suggesting instead of using SYNC_LOCK, for better code transparency, we should place the code that accesses the listener's fields from the main thread into AWT Event Queue with EventQueue.invokeAndWait? Can you please check if the update code meets your suggestion? Thanks.

Yes. Half of the access to the state of the listener is already on the even queue. It would be pretty transparent to make the other part of the access to go through the queue.

@songpv-imt
Copy link
Contributor Author

@shurymury The last code commit has implemented the changes based on your suggestion. Can you please advise what other step I should take to complete this bug ? Thanks.

@mrserb
Copy link
Member

mrserb commented Dec 2, 2023

The root cause of the bug is because mousePress() method is invoked before mouseMove() event is completely processed causing the drag & drop behavior not being able to be recognized properly.

Why this issue can be reproduced in macOS 14? What was changed in that version?

@songpv-imt
Copy link
Contributor Author

Why this issue can be reproduced in macOS 14? What was changed in that version?

I am uncertain about the exact code modifications in MacOS 14 that make this issue reproducible. Nevertheless, considering the underlying code logic, this issue could occur on any version of MacOS, contingent on timing factors, if the fix is not applied.

- Replace Thread.sleep by robot.delay
- Fix the code's formatting
Copy link
Contributor

@honkar-jdk honkar-jdk left a comment

Choose a reason for hiding this comment

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

Both the original test and updated test in this PR pass on the latest macOS version 14.2. Since this is a test stabilization fix I would like to suggest a change to JBS title to reflect it since the current one might be misleading.

- Update success1 and success2 to volatile
@victordyakov
Copy link

@songpv-imt any plans to resume your work on this fix?

@songpv-imt
Copy link
Contributor Author

@victordyakov, hmm... I think I have addressed all comments from the reviewers. Any other action I need to follow up? Thank.

@openjdk
Copy link

openjdk bot commented Jan 16, 2024

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

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

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

8317287: [macos14] InterJVMGetDropSuccessTest.java: Child VM: abnormal termination

Reviewed-by: honkar, aivanov, shurailine

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 846 new commits pushed to the master branch:

  • ff8cc26: 8323694: RISC-V: Unnecessary ResourceMark in NativeCall::set_destination_mt_safe
  • dadd9cd: 8316497: ColorConvertOp - typo for non-ICC conversions needs one-line fix
  • de237fb: 8323554: The typos in Javadoc: "@return if "
  • 51dbd36: 8322100: Fix GCMIncrementByte4 & GCMIncrementDirect4, and increase overlap testing
  • ffa33d7: 8317771: [macos14] Expand/collapse a JTree using keyboard freezes the application in macOS 14 Sonoma
  • 4e53235: 8323710: (fc) FileChannel.lock creates a FileKey with a poor hashCode after JDK-8321429 (win)
  • 19287ee: 8321561: (fs) Clarify non-atomic behavior of Files.move
  • 8b29e12: 8323794: Remove unused jimage compressor plugin configuration
  • 7be9f1d: 8321137: Reconsider ICStub alignment
  • b8dafa6: 8323612: IOVecWrapper should be changed to be TerminatingThreadLocal
  • ... and 836 more: https://git.openjdk.org/jdk/compare/419ed90770a13a728eae6f2317bdefe45281a461...master

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 (@prrace, @honkar-jdk, @aivanov-jdk) 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 Jan 16, 2024
Copy link
Contributor

@honkar-jdk honkar-jdk left a comment

Choose a reason for hiding this comment

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

Ran the updated test on macOS 13 and 14.2, it works well with the stabilization fix done for macOS 14.1. Changes look good.

@aivanov-jdk
Copy link
Member

Ran the updated test on macOS 13 and 14.2, it works well with the stabilization fix done for macOS 14.1. Changes look good.

I ran a job with 50 repeats of the test in our CI, the test passes. I've submitted a new job, just in a case, with the most recent changes.

@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 16, 2024
@openjdk openjdk bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 16, 2024
@songpv-imt
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jan 16, 2024
@openjdk
Copy link

openjdk bot commented Jan 16, 2024

@songpv-imt
Your change (at version 2bd0e22) is now ready to be sponsored by a Committer.

@openjdk openjdk bot removed the sponsor Pull request is ready to be sponsored label Jan 17, 2024
Copy link
Member

@aivanov-jdk aivanov-jdk left a comment

Choose a reason for hiding this comment

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

Thank you for updating it.

@songpv-imt
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jan 18, 2024
@openjdk
Copy link

openjdk bot commented Jan 18, 2024

@songpv-imt
Your change (at version 8d44f4c) is now ready to be sponsored by a Committer.

@aivanov-jdk
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Jan 18, 2024

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

  • 57fad67: 8323667: Library debug files contain non-reproducible full gcc include paths
  • ff8cc26: 8323694: RISC-V: Unnecessary ResourceMark in NativeCall::set_destination_mt_safe
  • dadd9cd: 8316497: ColorConvertOp - typo for non-ICC conversions needs one-line fix
  • de237fb: 8323554: The typos in Javadoc: "@return if "
  • 51dbd36: 8322100: Fix GCMIncrementByte4 & GCMIncrementDirect4, and increase overlap testing
  • ffa33d7: 8317771: [macos14] Expand/collapse a JTree using keyboard freezes the application in macOS 14 Sonoma
  • 4e53235: 8323710: (fc) FileChannel.lock creates a FileKey with a poor hashCode after JDK-8321429 (win)
  • 19287ee: 8321561: (fs) Clarify non-atomic behavior of Files.move
  • 8b29e12: 8323794: Remove unused jimage compressor plugin configuration
  • 7be9f1d: 8321137: Reconsider ICStub alignment
  • ... and 837 more: https://git.openjdk.org/jdk/compare/419ed90770a13a728eae6f2317bdefe45281a461...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jan 18, 2024

@aivanov-jdk @songpv-imt Pushed as commit cbfddf4.

💡 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
client client-libs-dev@openjdk.org integrated Pull request has been integrated
7 participants