-
Bug
-
Resolution: Fixed
-
P2
-
11
-
b05
-
generic
-
generic
A recent change to jdk11 has exposed a very subtle race condition during a jdk11u build.
The fix forJDK-8257679, adds this changeset.
https://github.com/openjdk/jdk11u/commit/40f4fc2da8532252a1660c7f082eb19046f4bc70
$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_charset_decoder, \
$(TOOL_SPP) < $< >$@.tmp \
The problem above is two fold:
The Spp tool reads from stdin and writes to stdout and is missing a set of parenthesis.
The parenthesis is required otherwise a subtle race condition in the shell will clobber the output, resulting in mysterious build failures. This is consistently reproducible on Windows and if the top-level make is invoked via Python .
So why is the missing parenthesis a problem ?
Please read this comment very carefully.
https://github.com/openjdk/jdk11u/blob/master/make/common/MakeBase.gmk#L1060
Adding the ExcecuteWithLog will result in a pseudo code as follows:
Spp < in-file > out-file > (some.log) (blah)
Notice the second redirection to stdout in the above.
Now adding a parenthesis will create a subshell and redirect the output (if any) from the tool.
(Spp < in-file > out-file) > (some.log) (blah)
There are couple of ways of solving this:
1. Undo the change introduced byJDK-8257679
2. Add parenthesis to all those call-sites of Spp with ExecuteWithLog
3. Back-port the change for Spp and fix the call-sites to use -i and -o arguments instead of reading stdin and writing to stdout.
https://github.com/openjdk/jdk/blob/master/make/jdk/src/classes/build/tools/spp/Spp.java
IMHO #3 is the way to go, when the legacy Spp shell script was converted to Java, it should have eliminated the need for stdin/stdout operations and replaced with input/output files.
The fix for
https://github.com/openjdk/jdk11u/commit/40f4fc2da8532252a1660c7f082eb19046f4bc70
$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_charset_decoder, \
$(TOOL_SPP) < $< >$@.tmp \
The problem above is two fold:
The Spp tool reads from stdin and writes to stdout and is missing a set of parenthesis.
The parenthesis is required otherwise a subtle race condition in the shell will clobber the output, resulting in mysterious build failures. This is consistently reproducible on Windows and if the top-level make is invoked via Python .
So why is the missing parenthesis a problem ?
Please read this comment very carefully.
https://github.com/openjdk/jdk11u/blob/master/make/common/MakeBase.gmk#L1060
Adding the ExcecuteWithLog will result in a pseudo code as follows:
Spp < in-file > out-file > (some.log) (blah)
Notice the second redirection to stdout in the above.
Now adding a parenthesis will create a subshell and redirect the output (if any) from the tool.
(Spp < in-file > out-file) > (some.log) (blah)
There are couple of ways of solving this:
1. Undo the change introduced by
2. Add parenthesis to all those call-sites of Spp with ExecuteWithLog
3. Back-port the change for Spp and fix the call-sites to use -i and -o arguments instead of reading stdin and writing to stdout.
https://github.com/openjdk/jdk/blob/master/make/jdk/src/classes/build/tools/spp/Spp.java
IMHO #3 is the way to go, when the legacy Spp shell script was converted to Java, it should have eliminated the need for stdin/stdout operations and replaced with input/output files.
- relates to
-
JDK-8218460 Test generation scripts do not invoke stream preprocessor correctly
- Resolved
-
JDK-8257679 Improved unix compatibility layer in Windows build (winenv)
- Resolved