RFR: 8289079: java/lang/Thread/jni/AttachCurrentThread/AttachTest.java#id1 failed with "RuntimeException: Test failed"

Alan Bateman alanb at openjdk.org
Sun Jun 26 10:39:39 UTC 2022


This is a fix to a recently added test. The test uses pthread_create to create native threads that invoke a Java method via a generated "upcall stub". The upcall stub is created in an implicit memory session but the test doesn't do anything to ensure that the memory session remains open. Testing in higher tiers runs the test with options that sometimes lead to a cleaner closing the memory session before the native threads have terminated. The failure mode is exit code 133 due to a child VM exiting with SIGTRAP. The test needs to be changed to ensure that the memory session is not closed until the threads terminate. To keep it simple, I've changed it to use the global memory session. The alternative is to change it to use a shared session or a reachability fence, coupled with a pthread_join to ensure that all native threads with a reference to stub terminate before the session is closed. The test is intended to exercise concurrent implicit attaching so keeping it as simple as possible
  seems best.

The test is also changed too use shouldHaveExitValue(0) as the original test discarded the child VM exit code when the test failed.

-------------

Commit messages:
 - Initial commit

Changes: https://git.openjdk.org/jdk19/pull/73/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk19&pr=73&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8289079
  Stats: 4 lines in 2 files changed: 0 ins; 2 del; 2 mod
  Patch: https://git.openjdk.org/jdk19/pull/73.diff
  Fetch: git fetch https://git.openjdk.org/jdk19 pull/73/head:pull/73

PR: https://git.openjdk.org/jdk19/pull/73


More information about the core-libs-dev mailing list