Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stackoverflow on process-asciidoc goal #581

Open
2 of 3 tasks
Nico-DF opened this issue Jun 6, 2022 · 0 comments
Open
2 of 3 tasks

Stackoverflow on process-asciidoc goal #581

Nico-DF opened this issue Jun 6, 2022 · 0 comments

Comments

@Nico-DF
Copy link

Nico-DF commented Jun 6, 2022

What is this issue about?

  • Bug report
  • Feature request
  • Question

Description

I currently use asciidoctor along with Spring REST Doc to produce our REST API documentation (deemed better for our usecase than openAPI as it can be easily extended and diagrams can be used)

I have setup on my maven project (multi-module) a module dedicated to the documentation: it contains .adoc files and Spring REST Docs tests.

Plugin Configuration

      <plugin>
        <groupId>org.asciidoctor</groupId>
        <artifactId>asciidoctor-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>generate-docs-official-html</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>process-asciidoc</goal>
            </goals>
            <configuration>
              <requires>
                <require>asciidoctor-diagram</require>
              </requires>
              <backend>html5</backend>
              <doctype>book</doctype>
              <attributes>
                <snippets>${snippets.path}</snippets>
                <revnumber>${doc.version}</revnumber>
                <revdate>${maven.build.timestamp}</revdate>
                <organization>${project.organization.name}</organization>
              </attributes>
              <sourceDirectory>${doc.basepath}/documentation</sourceDirectory>
              <outputDirectory>${doc.output.basepath}/documentation/html</outputDirectory>
              <extensions>
                <extension>
                  <className>my.project.doc.HttpExampleMacroProcessor</className>
                </extension>
              </extensions>
              <logHandler>
                <outputToConsole>true</outputToConsole>
                <failIf>
                  <severity>ERROR</severity>
                </failIf>
              </logHandler>
            </configuration>
          </execution>
        </executions>
      </plugin>

N.B.: Removing logHandler configuration does not seem to change anything

If I run the following goal at the module level:
mvn asciidoctor:process-asciidoc@generate-docs-official-html

It often works, but sometime, I get a stackoverflow error:

Some of the Stackoverflow stacktrace

Exception in thread "main" java.lang.StackOverflowError
	at uri_3a_classloader_3a_.gems.asciidoctor_minus_2_dot_0_dot_17.lib.asciidoctor.reader.RUBY$method$shift$0$__VARARGS__(uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/reader.rb:443)
	at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:80)
	at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:70)
	at org.jruby.ir.runtime.IRRuntimeHelpers.instanceSuper(IRRuntimeHelpers.java:1169)
	at uri_3a_classloader_3a_.gems.asciidoctor_minus_2_dot_0_dot_17.lib.asciidoctor.reader.invokeSuper5:shift(uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/reader.rb:763)
	at uri_3a_classloader_3a_.gems.asciidoctor_minus_2_dot_0_dot_17.lib.asciidoctor.reader.RUBY$method$shift$0(uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/reader.rb:763)
	at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:93)
	at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:105)
	at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192)
	at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:142)
	at uri_3a_classloader_3a_.gems.asciidoctor_minus_2_dot_0_dot_17.lib.asciidoctor.reader.invokeOther42:shift(uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/reader.rb:866)
	at uri_3a_classloader_3a_.gems.asciidoctor_minus_2_dot_0_dot_17.lib.asciidoctor.reader.RUBY$method$process_line$0(uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/reader.rb:866)
	at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:106)
	at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:140)
	at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:200)
	at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:173)
	at uri_3a_classloader_3a_.gems.asciidoctor_minus_2_dot_0_dot_17.lib.asciidoctor.reader.invokeOther14:process_line(uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/reader.rb:137)
	at uri_3a_classloader_3a_.gems.asciidoctor_minus_2_dot_0_dot_17.lib.asciidoctor.reader.RUBY$method$peek_line$0(uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/reader.rb:137)
	at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:80)
	at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:70)
	at org.jruby.ir.runtime.IRRuntimeHelpers.instanceSuper(IRRuntimeHelpers.java:1169)
	at uri_3a_classloader_3a_.gems.asciidoctor_minus_2_dot_0_dot_17.lib.asciidoctor.reader.invokeSuper0:peek_line(uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/reader.rb:652)
	at uri_3a_classloader_3a_.gems.asciidoctor_minus_2_dot_0_dot_17.lib.asciidoctor.reader.RUBY$method$peek_line$0(uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/reader.rb:652)
	at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:80)
	at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:90)
	at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:105)
	at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192)
	at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:142)
	at uri_3a_classloader_3a_.gems.asciidoctor_minus_2_dot_0_dot_17.lib.asciidoctor.reader.invokeOther15:peek_line(uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/reader.rb:137)
	at uri_3a_classloader_3a_.gems.asciidoctor_minus_2_dot_0_dot_17.lib.asciidoctor.reader.RUBY$method$peek_line$0(uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/reader.rb:137)
	at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:80)
	at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:70)
	at org.jruby.ir.runtime.IRRuntimeHelpers.instanceSuper(IRRuntimeHelpers.java:1169)
	at uri_3a_classloader_3a_.gems.asciidoctor_minus_2_dot_0_dot_17.lib.asciidoctor.reader.invokeSuper0:peek_line(uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/reader.rb:652)
	at uri_3a_classloader_3a_.gems.asciidoctor_minus_2_dot_0_dot_17.lib.asciidoctor.reader.RUBY$method$peek_line$0(uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/reader.rb:652)
	at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:80)
	at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:90)
	at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:105)
	at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192)
	at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:142)
	at uri_3a_classloader_3a_.gems.asciidoctor_minus_2_dot_0_dot_17.lib.asciidoctor.reader.invokeOther15:peek_line(uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/reader.rb:137)
	at uri_3a_classloader_3a_.gems.asciidoctor_minus_2_dot_0_dot_17.lib.asciidoctor.reader.RUBY$method$peek_line$0(uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/reader.rb:137)
	at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:80)
	at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:70)
	at org.jruby.ir.runtime.IRRuntimeHelpers.instanceSuper(IRRuntimeHelpers.java:1169)
	at uri_3a_classloader_3a_.gems.asciidoctor_minus_2_dot_0_dot_17.lib.asciidoctor.reader.invokeSuper0:peek_line(uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/reader.rb:652)
	at uri_3a_classloader_3a_.gems.asciidoctor_minus_2_dot_0_dot_17.lib.asciidoctor.reader.RUBY$method$peek_line$0(uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/reader.rb:652)
	at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:80)
	at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:90)
	at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:105)
	at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192)
	at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:142)
......

Moreover, if I launch the goal with intellij on debug mode, it will always fail with a stackoverflow error.

Workaround / Suggestion

One obvious way to "solve" this, it to set the Xss option of the jvm to Xss2m (seems enough for my project for the moment)

However:

  1. I don't know if it is really a good idea. If there is indeed a real issue on asciidoctor, jruby or something else, then I simply hide the error for now
  2. If it is "normal" as I produce quite a lot of documentation, then I think it would be great to, if it possible (don't really know how the plugin works internally), to set the jvm option in the plugin with something like:
<configuration>
  <argLine>-Xss2m</argLine>
</configuration>

Environment information

  • asciidoctor-maven-plugin version: 2.2.2
  • asciidoctorj version: 2.5.4
  • Maven, Java and OS version:
    • mvn: 3.8.4
    • java: 17
    • OS: w10 x64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant