aldaris / docbook-linktester

Tests external links and olinks in DocBook documentation for validity
3 stars 1 forks source link

Error when writing output file #4

Closed markcraig closed 11 years ago

markcraig commented 11 years ago

As described in https://bugster.forgerock.org/jira/browse/DOCS-69, in testing docbook-linktester (1.2.0-SNAPSHOT) encounters an error while writing the output file:

[INFO] Running linktester...
....
[DEBUG] Configuring mojo org.forgerock.maven.plugins:linktester-maven-plugin:1.2.0-SNAPSHOT:check from plugin realm ClassRealm[plugin>org.forgerock.maven.plugins:linktester-maven-plugin:1.2.0-SNAPSHOT, parent: sun.misc.Launcher$AppClassLoader@60396ed8]
[DEBUG] Configuring mojo 'org.forgerock.maven.plugins:linktester-maven-plugin:1.2.0-SNAPSHOT:check' with basic configurator -->
[DEBUG]   (f) includes =     [/Users/mark/Documents/workspace/opendj/opendj3/target/generated-docbkx/**/index.xml]
[DEBUG]   (f) validating = true
[DEBUG]   (f) skipUrls = false
[DEBUG]   (f) xIncludeAware = true
[DEBUG]   (f) failOnError = false
[DEBUG]   (f) outputFile = /Users/mark/Documents/workspace/opendj/opendj3/target/docbkx/linktester.err
[DEBUG]   (f) skipUrlPatterns = [^https://bugster.forgerock.org/jira/browse/OPEN(AM|ICF|IDM|IG|DJ)-[0-9]{1,4}$, ^http://tools.ietf.org/html/rfc[0-9]+$]
[DEBUG]   (f) project = MavenProject: org.forgerock.opendj:opendj-project:3.0.0-SNAPSHOT @ /Users/mark/Documents/workspace/opendj/opendj3/pom.xml
[DEBUG]   (f) skipOlinks = false
[DEBUG] -- end configuration --
[INFO] DocBook links successfully tested, no errors reported.
[ERROR] Error while writing to outputFile: Stream closed

The output file exists but is of 0 length.

$ ls -l target/docbkx/linktester.err 
-rw-r--r--  1 mark  staff  0 Apr 17 13:47 target/docbkx/linktester.err
aldaris commented 11 years ago

Yeah, it seems I close the stream in the code, but I still try to write some log entry to it afterwards, will fix it up..

aldaris commented 11 years ago

Should be fixed now, could you give it a go?

markcraig commented 11 years ago

The fix works great when I either build the doc build plugin with Java 6, or get docbook-linktester and build it with Java 7, then build my plugin with Java 7.

I ran into a surprising crash when getting the version from the ForgeRock repo which I assume was built with Java 6, and then when I built my plugin and ran with Java 7.

[INFO] Running linktester...
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fff915ff24b, pid=4241, tid=7171
#
# JRE version: 7.0_17-b02
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.7-b01 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C  [libsystem_c.dylib+0x2824b]  memmove$VARIANT$sse3x+0x38e
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/mark/Documents/workspace/opendj/opendj3/hs_err_pid4241.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Abort trap: 6

This is the JVM apparently crashing in native code. Excerpt...

Stack: [0x00000001017a8000,0x00000001018a8000],  sp=0x00000001018a5360,  free space=1012k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libsystem_c.dylib+0x2824b]  memmove$VARIANT$sse3x+0x38e
C  [libzip.dylib+0x3324]  newEntry+0x31a
C  [libzip.dylib+0x37d0]  ZIP_GetEntry+0xa2
C  [libzip.dylib+0x262a]  Java_java_util_zip_ZipFile_getEntry+0xdd
J  java.util.zip.ZipFile.getEntry(J[BZ)J

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J  java.util.zip.ZipFile.getEntry(J[BZ)J
J  java.util.jar.JarFile.getEntry(Ljava/lang/String;)Ljava/util/zip/ZipEntry;
j  sun.net.www.protocol.jar.URLJarFile.getEntry(Ljava/lang/String;)Ljava/util/zip/ZipEntry;+2
j  sun.net.www.protocol.jar.JarURLConnection.connect()V+62
j  sun.net.www.protocol.jar.JarURLConnection.getInputStream()Ljava/io/InputStream;+1
j  java.net.URL.openStream()Ljava/io/InputStream;+4
markcraig commented 11 years ago

The fix also works fine when I take the Jenkins built doc plugin (built with the same version of Java), so I'd consider it done.

aldaris commented 11 years ago

Thanks for confirming. I'm not quite sure about the JVM crash myself, but sounds like a Java 7 strangeness to me (and seems to be more related to Maven invoking my plugin than my plugin doing something nasty).