Skip to content

Conversation

@RogerRiggs
Copy link
Contributor

@RogerRiggs RogerRiggs commented Aug 19, 2022

On Mac OS X on aarch64, the timing of the sysctl vs the process life (pid) can be such that the sysctl returns EIO.
The native implementation is modified to treat EIO the same as EINVAL, leaving the information to be returned empty.

Several tests in java/lang/ProcessHandle failed with the same cause including OnExitTest, InfoTest, and TreeTest.


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-8276651: java/lang/ProcessHandle tests fail with "RuntimeException: Input/output error" in java.lang.ProcessHandleImpl$Info.info0

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9946

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

Using diff file

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

…ception: Input/output error"

If the pid is invalid, errno == EIO(5), the information returned is empty and no exception is thrown
@bridgekeeper
Copy link

bridgekeeper bot commented Aug 19, 2022

👋 Welcome back rriggs! 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.

@RogerRiggs
Copy link
Contributor Author

RogerRiggs commented Aug 19, 2022

/issue 8273773

@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 19, 2022
@openjdk
Copy link

openjdk bot commented Aug 19, 2022

@RogerRiggs Command syntax:

  • /issue [add|remove] <id>[,<id>,...]
  • /issue [add] <id>: <description>
  • `/issue create [PX] /[subcomponent]

Some examples:

  • /issue add JDK-1234567,4567890
  • /issue remove JDK-4567890
  • /issue 1234567: Use this exact title
  • `/issue create hotspot/jfr
  • `/issue create P4 core-libs/java.nio

If issues are specified only by their ID, the title will be automatically retrieved from JBS. The project prefix (JDK- in the above examples) is optional. Separate multiple issue IDs using either spaces or commas.

@openjdk
Copy link

openjdk bot commented Aug 19, 2022

@RogerRiggs The following label will be automatically applied to this pull request:

  • core-libs

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 core-libs core-libs-dev@openjdk.org label Aug 19, 2022
@mlbridge
Copy link

mlbridge bot commented Aug 19, 2022

Webrevs

@jaikiran
Copy link
Member

Hello Roger,

On Mac OS X on aarch64, the timing of the sysctl vs the process life (pid) can be such that the sysctl returns EIO.

The ProcessHandleImpl_unix.c in its info0 implementation calls os_getParentPidAndTimings and this os_getCmdlineAndUserInfo. The os_getParentPidAndTimings in ProcessHandleImpl_macosx.c too has a call to systctl with the passed pid (line 191). If that call fails, we currently don't check the errno and just throw a RuntimeException. Would that need a change too, since it queries for a particular process?

There's one another call to sysctl in os_getCmdlineAndUserInfo at line 253, but that doesn't appear to be specific to the pid, so I guess that wouldn't fail due to the timing of process lifetime.

@RogerRiggs
Copy link
Contributor Author

The failing tests don't implicate the sysctl at 191 so I'm cautious about changing the code in that case.
The spec for ProcessHandle.info() does not declare any exceptions so there is little risk changing the behavior by quietly returning in the case of EINVAL or EIO to make the cases similar when querying a pid.

@jaikiran
Copy link
Member

Thank you for that detail, Roger. The change looks fine to me.

@RogerRiggs
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Aug 23, 2022

@RogerRiggs This pull request has not yet been marked as ready for integration.

@RogerRiggs RogerRiggs changed the title 8276651: java/lang/ProcessHandle/InfoTest.java failed with "RuntimeException: Input/output error" 8276651: java/lang/ProcessHandle tests fail with "RuntimeException: Input/output error" in java.lang.ProcessHandleImpl$Info.info0 Aug 23, 2022
@openjdk
Copy link

openjdk bot commented Aug 23, 2022

@RogerRiggs 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:

8276651: java/lang/ProcessHandle tests fail with "RuntimeException: Input/output error" in java.lang.ProcessHandleImpl$Info.info0

Reviewed-by: jpai, alanb

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

  • cf00677: 8292368: [ppc64] internal error g1BarrierSet.inline.hpp assert(oopDesc::is_oop(pre_val, true)) failed: Error
  • d92e00a: 8292763: JDK-8292716 breaks configure without jtreg
  • 486f90c: 8292716: Configure should check that jtreg is of the required version
  • b4e1aa8: 8289658: Avoid redundant LinkedHashMap.get call in TagletManager.addNewSimpleCustomTag
  • 84936e9: 8292586: simplify cleanups in NTLMAuthSequence getCredentialsHandle
  • 259ba86: 8290075: [JVMCI] only blessed methods can link against EventWriterFactory.getEventWriter
  • a85a723: 8292351: tty should always live
  • 4da1745: 8291118: [vectorapi] Optimize the implementation of lanewise FIRST_NONZERO
  • 38a8191: 8290322: Optimize Vector.rearrange over byte vectors for AVX512BW targets.
  • 27af014: 8292743: Missing include resourceHash.hpp
  • ... and 52 more: https://git.openjdk.org/jdk/compare/833bf06905bb616782bdba6947b1edfaf479310f...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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Aug 23, 2022
@RogerRiggs
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Aug 23, 2022

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

  • 8a45abd: 8292654: G1 remembered set memory footprint regression after JDK-8286115
  • cc28783: 8292777: Remove hashtable.hpp from dependencies.hpp
  • cf00677: 8292368: [ppc64] internal error g1BarrierSet.inline.hpp assert(oopDesc::is_oop(pre_val, true)) failed: Error
  • d92e00a: 8292763: JDK-8292716 breaks configure without jtreg
  • 486f90c: 8292716: Configure should check that jtreg is of the required version
  • b4e1aa8: 8289658: Avoid redundant LinkedHashMap.get call in TagletManager.addNewSimpleCustomTag
  • 84936e9: 8292586: simplify cleanups in NTLMAuthSequence getCredentialsHandle
  • 259ba86: 8290075: [JVMCI] only blessed methods can link against EventWriterFactory.getEventWriter
  • a85a723: 8292351: tty should always live
  • 4da1745: 8291118: [vectorapi] Optimize the implementation of lanewise FIRST_NONZERO
  • ... and 54 more: https://git.openjdk.org/jdk/compare/833bf06905bb616782bdba6947b1edfaf479310f...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Aug 23, 2022

@RogerRiggs Pushed as commit d24b7b7.

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

@RogerRiggs RogerRiggs deleted the 8276651-inputoutput-error branch December 11, 2023 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants