RFR: JDK-8074072 Race condition in build since JDK-8072842 can cause failed builds on Solaris

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Mon Mar 2 11:06:33 UTC 2015


A race condition, possibly leading to a failed build on Solaris, was introduced with JDK-8072842. 

The two Solaris helper script fix_empty_sec_hdr_flags and add_gnu_debuglink are built several times, in the same location. 

If we are unlucky then thread A does: 
  A1: compile add_gnu_link.c 
  A2: link add_gnu_link 
and thread B does: 
  B1: compile add_gnu_link.c 
after A1 but before A2, so that when linking is about to start, the .o file has been truncated, and then linking will fail. 

A typical error message looks like this: 
Main.gmk:264: recipe for target 'build-test-hotspot-jtreg-native' failed     
ld: fatal: file /opt/jprt/T/P1/002839.magnusi/s/build/solaris-sparcv9-normal-server-release/buildtools/objs/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.o: not an ELF object 
ld: fatal: file processing errors. No output written to /opt/jprt/T/P1/002839.magnusi/s/build/solaris-sparcv9-normal-server-release/buildtools/bin/fix_empty_sec_hdr_flags
gmake[3]: *** [/opt/jprt/T/P1/002839.magnusi/s/build/solaris-sparcv9-normal-server-release/buildtools/bin/fix_empty_sec_hdr_flags] Error 2 

The proper long-term solution is to fix JDK-8064808. However, since this issue causes a build break, a quicker and less risky fix is to let build-test-*-jtreg-native depend on buildtools-jdk.

It is by definition hard to test that a race condition has been resolved, but I have tried this at least a dozen times with no failures.

https://bugs.openjdk.java.net/browse/JDK-8074072

Fix inline:

diff --git a/make/Main.gmk b/make/Main.gmk
--- a/make/Main.gmk
+++ b/make/Main.gmk
@@ -433,6 +433,10 @@
 
   test-make: clean-test-make
 
+  build-test-hotspot-jtreg-native: buildtools-jdk
+
+  build-test-jdk-jtreg-native: buildtools-jdk
+
   test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native
 
   test-image-jdk-jtreg-native: build-test-jdk-jtreg-native

/Magnus



More information about the build-dev mailing list