#127 Dogtag 10 - Sporadic Build Failures
Closed: Fixed Opened by mharmsen.

Most of the time, Dogtag 10 builds successfully.

However, on occasions (which have currently only been encountered when using 'mock'), indeterminate build failures have been encountered which appear to pertain to the multi-thread building capabilities of 'cmake':

  DEBUG: Building Java objects for pki-jndi-realm.jar
  DEBUG: cd /builddir/build/BUILD/pki-core-10.0.0.a1/base/common/src && /usr/bin/javac -encoding UTF-8 -classpath :/builddir/build/BUILD/pki-core-10.0.0.a1/build/base/util/src/pki-nsutil-10.0.0.jar:/builddir/build/BUILD/pki-core-10.0.0.a1/build/base/util/src/pki-cmsutil-10.0.0.jar:/usr/share/java/ldapjdk.jar:/usr/share/java/servlet.jar:/usr/share/java/velocity.jar:/usr/share/java/xalan-j2.jar:/usr/share/java/xerces-j2.jar:/usr/lib/java/jss4.jar:/usr/share/java/commons-codec.jar:/usr/share/java/tomcat6/catalina.jar:/builddir/build/BUILD/pki-core-10.0.0.a1/build/base/symkey/src/symkey-10.0.0.jar:/usr/share/candlepin/lib/jaxrs-api-2.2.1.GA.jar:/usr/share/candlepin/lib/resteasy-jaxrs-2.2.1.GA.jar:/builddir/build/BUILD/pki-core-10.0.0.a1/base/common/src:/builddir/build/BUILD/pki-core-10.0.0.a1/build/base/common/src -d /builddir/build/BUILD/pki-core-10.0.0.a1/build/base/common/src/CMakeFiles/pki-jndi-realm.dir com/netscape/cmscore/realm/PKIJNDIRealm.java com/netscape/cmscore/realm/ACLEntry.java com/netscape/cmscore/realm/ACL.java
  DEBUG: Note: Some input files use or override a deprecated API.
  DEBUG: Note: Recompile with -Xlint:deprecation for details.
  DEBUG: Note: Some input files use unchecked or unsafe operations.
  DEBUG: Note: Recompile with -Xlint:unchecked for details.
  DEBUG: cd /builddir/build/BUILD/pki-core-10.0.0.a1/base/util/src && /usr/bin/cmake -DCMAKE_JAVA_CLASS_OUTPUT_PATH=/builddir/build/BUILD/pki-core-10.0.0.a1/build/base/util/src/CMakeFiles/pki-nsutil.dir -DCMAKE_JAR_CLASSES_PREFIX="netscape" -P /builddir/build/BUILD/pki-core-10.0.0.a1/cmake/Modules/UseJavaClassFilelist.cmake
  DEBUG: -- JAR_CLASS_PREFIX: netscape
  DEBUG: Creating Java archive pki-nsutil-10.0.0.jar
  DEBUG: cd /builddir/build/BUILD/pki-core-10.0.0.a1/build/base/util/src/CMakeFiles/pki-nsutil.dir && /usr/bin/jar -cf /builddir/build/BUILD/pki-core-10.0.0.a1/build/base/util/src/pki-nsutil-10.0.0.jar @java_class_filelist
  DEBUG: error: error reading /builddir/build/BUILD/pki-core-10.0.0.a1/build/base/util/src/pki-nsutil-10.0.0.jar; error in opening zip file
  DEBUG: 1 error
  DEBUG: make[2]: *** [pki-jndi-realm] Error 1
  DEBUG: make[2]: Leaving directory `/builddir/build/BUILD/pki-core-10.0.0.a1/build'
  DEBUG: make[1]: *** [base/common/src/CMakeFiles/pki-jndi-realm.dir/all] Error 2
  DEBUG: make[1]: *** Waiting for unfinished jobs....

It looks a bit confusing because I think there are two threads running,
and they are building pki-nsutil and pki-jndi-realm concurrently. It
looks though like pki-nsutil is required by pki-jndi-realm, and cmake
just does not know this. In the case where the build is successful,
pki-nsutil has already been built when pki-jndi-realm is built.

It this were true, then the fix would be add the dependency in the
base/common/src/CMakeLists.txt file as follows:

  set(CMAKE_JAR_CLASSES_PREFIX com/netscape/cmscore/realm)
  add_jar(pki-jndi-realm ${pki-jndi-realm_SRCS})
  add_dependencies(pki-nsutil)
  install_jar(pki-jndi-realm ${JAVA_JAR_INSTALL_DIR}/pki)
  set(PKI_JNDI_REALM_JAR ${pki-jndi-realm_JAR_FILE} CACHE INTERNAL "pki-jndi-realm jar file")

The add_dependencies line is currently not in the code, but it would
presumably result in pki-nsutil being built before pki-jndi-realm. Its
not clear to me though that pki-jndi-realm actually uses anything in
pki-nsutil.


Is pki-nsutil needed as a dependency or not or is it maybe something else. Make sure it depends on the right jar packages.

However the dependency line is not complete ;)

Put in defensive code to build dependencies I think will solve the problem.

Metadata Update from @mharmsen:
- Issue assigned to jmagne
- Issue set to the milestone: Dogtag 10.0 - Phase 1

Dogtag PKI is moving from Pagure issues to GitHub issues. This means that existing or new
issues will be reported and tracked through Dogtag PKI's GitHub Issue tracker.

This issue has been cloned to GitHub and is available here:
https://github.com/dogtagpki/pki/issues/699

If you want to receive further updates on the issue, please navigate to the
GitHub issue and click on Subscribe button.

Thank you for understanding, and we apologize for any inconvenience.

Metadata