Skip to content

Conversation

@larry-cable
Copy link
Contributor

@larry-cable larry-cable commented Mar 17, 2025

on both Linux and MacOS libattach utilizes UNIX signal (QUIT) to cause a target JVM (attachee) to create the socket file used as transport for subsequent jcmds (and other attach based interactions) and to listen upon that for such.

it should be noted that the default behavior for QUIT (if not blocked or caught) is to terminate the signalled process.

during the early lifetime of a JVM, its signal handlers are not yet installed, and thus any signal such as QUIT will cause the
default behavior to occur, in this case the JVM will be terminated.

this is why some tests are failing with "not alive"

the "fix" is similar in nature to that already implemented for linux (however using a different OS dependent mechanism to obtain the attachee JVM's signal masks: sysctl(2)).

the method "checkCatchesAndSendQuitTo" will now obtain the "attachee" JVM signal masks and only kill(QUIT) if the
current masks indicate that the JVM's signals are now being handled.

the behavior in the success case is now identical to the previous implementation, however should the target JVM not
become "ready" (signal handlers installed) prior to the attach "timeout" occurring the attach operation will throw an
"AttachNotSupportedException" with a suitable error message.

see also: https://bugs.openjdk.org/browse/JDK-8350766


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-8344671: Few JFR streaming tests fail with application not alive error on MacOS 15 (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 24085

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

Using diff file

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

Using Webrev

Link to Webrev Comment

…er state prior to sending QUIT, this will obviate early JVM termination when not ready to attach
@bridgekeeper
Copy link

bridgekeeper bot commented Mar 17, 2025

👋 Welcome back larry-cable! 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
Copy link

openjdk bot commented Mar 17, 2025

@larry-cable 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:

8344671: Few JFR streaming tests fail with application not alive error on MacOS 15

Reviewed-by: dholmes, kevinw

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

  • 49cb7aa: 8339114: DaCapo xalan performance with -XX:+UseObjectMonitorTable
  • d32ff13: 8353117: Crash: assert(id >= ThreadIdentifier::initial() && id < ThreadIdentifier::current()) failed: must be reasonable)
  • a0677d9: 8353263: Parallel: Remove locking in PSOldGen::resize
  • 8608b16: 8348887: Create IR framework test for JDK-8347997
  • 23eb648: 8353545: Improve debug info for StartOptionTest
  • 4f97c4c: 8349211: Add support for intrusive trees to the utilities red-black tree
  • c9baa8a: 8352418: Add verification code to check that the associated loop nodes of useless Template Assertion Predicates are dead
  • b80b04d: 8353329: Small memory leak when create GrowableArray with initial size 0
  • 4a50778: 8353458: Don't pass -Wno-format-nonliteral to CFLAGS
  • 9076673: 8304674: File java.c compile error with -fsanitize=address -O0
  • ... and 242 more: https://git.openjdk.org/jdk/compare/0460978e7c769624cacdb528277a99914b327e30...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 (@dholmes-ora, @kevinjwalls) 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 changed the title JDK-8344671: Few JFR streaming tests fail with application not alive error on MacOS 15 8344671: Few JFR streaming tests fail with application not alive error on MacOS 15 Mar 17, 2025
@openjdk
Copy link

openjdk bot commented Mar 17, 2025

@larry-cable The following label will be automatically applied to this pull request:

  • serviceability

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 serviceability serviceability-dev@openjdk.org label Mar 17, 2025
Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

Thanks very much for fixing this @larry-cable ! Changes look good. Just a few minor nits.

@dholmes-ora
Copy link
Member

Also you need to remove the ProblemList entries in test/jdk/ProblemList.txt.

@jaikiran
Copy link
Member

jcheck is complaining about some whitespace errors in this PR which is why the RFR email hasn't yet been generated.

@jaikiran
Copy link
Member

Hello Larry, there are a few more whitespace issues that's preventing a RFR from being intiated.

@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 26, 2025
@mlbridge
Copy link

mlbridge bot commented Mar 26, 2025

Webrevs

@jaikiran
Copy link
Member

I'm guessing it's not going to be easy to introduce a regression test for this change. If so, then the linked JDK issue will need a noreg label (likely noreg-hard).

larry-cable and others added 5 commits March 27, 2025 15:15
Co-authored-by: David Holmes <62092539+dholmes-ora@users.noreply.github.com>
Co-authored-by: David Holmes <62092539+dholmes-ora@users.noreply.github.com>
Co-authored-by: David Holmes <62092539+dholmes-ora@users.noreply.github.com>
@openjdk
Copy link

openjdk bot commented Mar 27, 2025

⚠️ @larry-cable This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

Looks good. Just a couple of remaining nits. Thanks.

closing the stable door after the horse has bolted

Co-authored-by: David Holmes <62092539+dholmes-ora@users.noreply.github.com>
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 31, 2025
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Mar 31, 2025
@larry-cable
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Mar 31, 2025

@larry-cable This pull request has not yet been marked as ready for integration.

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

Okay

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 31, 2025
Copy link
Contributor

@kevinjwalls kevinjwalls left a comment

Choose a reason for hiding this comment

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

Looks good.

(I'm sure the Linux and MacOS VirtualMachineImpl() attach/timeout loops are almost identical now, not a problem but maybe one day we can de-duplicate them.)

@kevinjwalls
Copy link
Contributor

/integrate

@openjdk
Copy link

openjdk bot commented Apr 2, 2025

@kevinjwalls Only the author (@larry-cable) is allowed to issue the integrate command.

@kevinjwalls
Copy link
Contributor

/sponsor

@openjdk
Copy link

openjdk bot commented Apr 2, 2025

@kevinjwalls The change author (@larry-cable) must issue an integrate command before the integration can be sponsored.

@larry-cable
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Apr 2, 2025
@openjdk
Copy link

openjdk bot commented Apr 2, 2025

@larry-cable
Your change (at version c27af72) is now ready to be sponsored by a Committer.

@kevinjwalls
Copy link
Contributor

/sponsor

@openjdk
Copy link

openjdk bot commented Apr 2, 2025

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

  • 49cb7aa: 8339114: DaCapo xalan performance with -XX:+UseObjectMonitorTable
  • d32ff13: 8353117: Crash: assert(id >= ThreadIdentifier::initial() && id < ThreadIdentifier::current()) failed: must be reasonable)
  • a0677d9: 8353263: Parallel: Remove locking in PSOldGen::resize
  • 8608b16: 8348887: Create IR framework test for JDK-8347997
  • 23eb648: 8353545: Improve debug info for StartOptionTest
  • 4f97c4c: 8349211: Add support for intrusive trees to the utilities red-black tree
  • c9baa8a: 8352418: Add verification code to check that the associated loop nodes of useless Template Assertion Predicates are dead
  • b80b04d: 8353329: Small memory leak when create GrowableArray with initial size 0
  • 4a50778: 8353458: Don't pass -Wno-format-nonliteral to CFLAGS
  • 9076673: 8304674: File java.c compile error with -fsanitize=address -O0
  • ... and 242 more: https://git.openjdk.org/jdk/compare/0460978e7c769624cacdb528277a99914b327e30...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Apr 2, 2025
@openjdk openjdk bot closed this Apr 2, 2025
@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 Apr 2, 2025
@openjdk
Copy link

openjdk bot commented Apr 2, 2025

@kevinjwalls @larry-cable Pushed as commit d979bd8.

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

*/
JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_sendQuitTo
(JNIEnv *env, jclass cls, jint pid)
JNIEXPORT jboolean JNICALL Java_sun_tools_attach_VirtualMachineImpl_checkCatchesAndSendQuitTo
Copy link
Member

Choose a reason for hiding this comment

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

I’m just curious - why does this method return a boolean? It looks like the result is never actually checked, and the control flow is managed through exceptions or errors(on both linux and macos).

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 serviceability serviceability-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

7 participants