RFR: 8307990: jspawnhelper must close its writing side of a pipe before reading from it

Thomas Stuefe stuefe at openjdk.org
Mon May 15 15:51:48 UTC 2023


On Mon, 15 May 2023 12:31:49 GMT, Volker Simonis <simonis at openjdk.org> wrote:

> > Looks ok.
> > Is it practical to write a test for this situation? Can I assume you've validated the improvement as a remedy for the observed hangs?
> 
> I thought about a test but couldn't come up with a practical way to write it. The JVM has to exit in the time frame after the `posix_spawn()` and before `jspawnhelper` has read its data from the parent. In production this usually happens due to memory constraints on the particular host which let the OOM-killer kill the JVM process because it is the biggest memory consumer.
> 

A regression test would be good.

This can be very simply a runtime switch that kills the parent process at vulnerable times. See my example here:

https://github.com/openjdk/jdk/compare/master...tstuefe:jdk:test-for-parent-premature-death

Using that (KILLTEST=1), I was able to reproduce your problem with the hanging child. Using this to build a jtreg test is not hard.

Cheers, Thomas

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

PR Comment: https://git.openjdk.org/jdk/pull/13956#issuecomment-1548113927


More information about the core-libs-dev mailing list