RFR: 8322324: java/foreign/TestStubAllocFailure.java times out while waiting for forked process [v2]

Jorn Vernee jvernee at openjdk.org
Wed Jan 10 10:59:45 UTC 2024


> The issue with this test, and the test of JDK-8322324, seems to be that the forked processes write to stderr/stdout, without this output being read before the process terminates. The buffer might fill up if the output is not being read, which means that the process will stall when writing (see stack trace in JBS issue).
> 
> `OutputAnalyzer` has ways to prevent this by continuously reading from the output streams in separate threads, but because the current code calls `Process::waitFor` before creating the `OutputAnalyzer`, we never actually read the written output of the fork, which occasionally results in a stall and subsequent timeout.
> 
> The fix proposed by this patch is to use `ProcessTools::startProcess`, instead of `ProcessBuilder::start`, which will also start the necessary reader threads, preventing a stall. Incidentally, `startProcess` also has built-in timeout handling which we can use.
> 
> Testing:
> -  500 runs of both java/foreign/TestStubAllocFailure.java and java/foreign/critical/TestCriticalUpcall on various Windows x64 hosts (100 iterations was enough to observe the failure twice).
> -  `jdk_foreign` suite.

Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision:

  Update copyright year

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/17324/files
  - new: https://git.openjdk.org/jdk/pull/17324/files/2ba2851c..58f5cabf

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=17324&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17324&range=00-01

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/17324.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17324/head:pull/17324

PR: https://git.openjdk.org/jdk/pull/17324


More information about the core-libs-dev mailing list