Great find Erik - thanks! Looks good to me.
David On 12/03/2013 6:39 PM, Erik Joelsson wrote:
Profiles builds are being plagued by intermittent failures due to exceptions in the meta-index builder, looking like this: Creating rt.jar profile_1 Compressed=false Creating resources.jar Updating rt.jar profile_1 Removed method addPropertyChangeListener(java.beans.PropertyChangeListener) from java/util/jar/Pack200$Packer Removed method removePropertyChangeListener(java.beans.PropertyChangeListener) from java/util/jar/Pack200$Packer Removed method addPropertyChangeListener(java.beans.PropertyChangeListener) from java/util/jar/Pack200$Unpacker Removed method removePropertyChangeListener(java.beans.PropertyChangeListener) from java/util/jar/Pack200$Unpacker Exception in thread "main" java.util.zip.ZipException: error in opening zip file at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:214) at java.util.zip.ZipFile.<init>(ZipFile.java:144) at java.util.jar.JarFile.<init>(JarFile.java:152) at java.util.jar.JarFile.<init>(JarFile.java:89) at build.tools.buildmetaindex.JarMetaIndex.<init>(BuildMetaIndex.java:186) at build.tools.buildmetaindex.BuildMetaIndex.main(BuildMetaIndex.java:96) I believe I have found the cause for it. Near the bottom of Images.gmk: ifneq ($(PROFILE),) # Files in lib$(PROFILE) are excluded from the generic copying routines so # we have to add them back in here $(foreach f,$(CUSTOM_PROFILE_JARS),\ $(eval $(call AddFileToCopy,$(IMAGES_OUTPUTDIR)/lib$(PROFILE),$(JRE_IMAGE_DIR)/lib,$f,JRE_LIB_TARGETS))) The above happens after the rules for building meta-indexes are declared: $(JRE_IMAGE_DIR)/lib/meta-index: $(JRE_LIB_TARGETS) $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index `$(LS) *.jar | $(SED) 's/JObjC\.jar//g'` This means that the variable JRE_LIB_TARGETS does not contain the jars that are copied from lib$(PROFILE) and the meta-index files are not declared dependent on those jars, which creates the race causing intermittent failures. It also explains why this only happens when building profiles and not images. Webrev moving the foreach loop to the lib section, above the meta-index rules declarations: http://cr.openjdk.java.net/~erikj/8009695/webrev.jdk.01/ /Erik