RFR: JDK-8154326: bash >(...) construct causes race conditions

Erik Joelsson erik.joelsson at oracle.com
Tue Apr 19 12:32:34 UTC 2016


Hello,

After switching to the new hotspot build, we have seen some sporadic 
build errors related to the generation of dtrace JvmOffsets.h file on 
Solaris. The errors look like a compile target that depends on the 
header file fails because the header file is either empty or incomplete. 
I have managed to reproduce this by running this particular part of the 
build in a loop within 5 minutes.

The header file generation uses the rather new ExecuteWithLog macro, 
which uses the also rather new ">(tee logfile)" construct to save output 
to a log file while still echoing both stderr and stdout separately to 
the console. It seems however, that when using this construct, bash 
spawns background processes which may not be done when the main process 
is done.

I have noted a similar effect when switching to this construct for the 
main makefile build.log. The last line of make output would be echoed to 
the console after my prompt returned.

To solve this, I added "&& wait" in each location where the >(...) trick 
is used. I have then rerun the loop over night and could no longer 
reproduce the problem. I believe this to be the proper solution.

Bug: https://bugs.openjdk.java.net/browse/JDK-8154326
Webrev: http://cr.openjdk.java.net/~erikj/8154326/webrev.01/

/Erik



More information about the build-dev mailing list