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

Cannot render more than N documents on the same Asciidoctor instance (fixed with jRuby 9.1.17.0) #680

Closed
abelsromero opened this issue Sep 25, 2018 · 10 comments

Comments

@abelsromero
Copy link
Member

AsciidoctorJ: 1.5.7
jRuby: 9.1.16.0 (default)
OS: Windows 10
JDK: 1.8.0_181

This is one of those weird issues...

Since version 1.5.7, if I try to render a set of documents reusing the same Asciidoctor instance, the process fails stating that it cannot read a document (see below). The error is always the same and happens on the same document.
I have been able to reproduce the issue rendering the same document in a loop and I have found the following:

  • The iteration in which it fails depends on the document. With the documents I have used for testing it sometimes fails on the loop 53, others on 62 🤷‍♂️ .
  • Using JRuby 9.1.17.0 seems to fix it (500 loops without issues), jRuby 9.2.0.0 does not work at all.
sep 25, 2018 3:09:53 PM org.asciidoctor.internal.JRubyAsciidoctor renderFile
GRAVE: (NoMethodError) asciidoctor: FAILED: C:/Users/asalgadr/github/asciidoctorj-gradle/src/asciidoc/user-password-expiration.adoc: Failed to load AsciiDoc document - undefined method `start_with?' for nil:NilClass
Exception in thread "main" org.asciidoctor.internal.AsciidoctorCoreException: org.jruby.exceptions.RaiseException: (NoMethodError) asciidoctor: FAILED: C:/Users/asalgadr/github/asciidoctorj-gradle/src/asciidoc/user-password-expiration.adoc: Failed to load AsciiDoc document - undefined method `start_with?' for nil:NilClass
	at org.asciidoctor.internal.JRubyAsciidoctor.renderFile(JRubyAsciidoctor.java:371)
	at org.asciidoctor.internal.JRubyAsciidoctor.renderFile(JRubyAsciidoctor.java:484)
	at org.asciidoctor.internal.JRubyAsciidoctor.convertFile(JRubyAsciidoctor.java:585)
	at org.asciidoctor.demos.AsciidoctorRunner.main(AsciidoctorRunner.java:30)
Caused by: org.jruby.exceptions.RaiseException: (NoMethodError) asciidoctor: FAILED: C:/Users/asalgadr/github/asciidoctorj-gradle/src/asciidoc/user-password-expiration.adoc: Failed to load AsciiDoc document - undefined method `start_with?' for nil:NilClass
	at RUBY.parse_section_title(uri:classloader:/gems/asciidoctor-1.5.7.1/lib/asciidoctor/parser.rb:1734)
	at RUBY.initialize_section(uri:classloader:/gems/asciidoctor-1.5.7.1/lib/asciidoctor/parser.rb:1564)
	at RUBY.next_section(uri:classloader:/gems/asciidoctor-1.5.7.1/lib/asciidoctor/parser.rb:290)
	at RUBY.parse(uri:classloader:/gems/asciidoctor-1.5.7.1/lib/asciidoctor/parser.rb:96)
	at RUBY.parse(uri:classloader:/gems/asciidoctor-1.5.7.1/lib/asciidoctor/document.rb:565)
	at RUBY.load(uri:classloader:/gems/asciidoctor-1.5.7.1/lib/asciidoctor.rb:1361)
	at RUBY.convert(uri:classloader:/gems/asciidoctor-1.5.7.1/lib/asciidoctor.rb:1473)
	at RUBY.block in convert_file(uri:classloader:/gems/asciidoctor-1.5.7.1/lib/asciidoctor.rb:1589)
	at org.jruby.RubyIO.open(org/jruby/RubyIO.java:1171)
	at RUBY.convert_file(uri:classloader:/gems/asciidoctor-1.5.7.1/lib/asciidoctor.rb:1589)
	at RUBY.convertFile(<script>:78)
@abelsromero
Copy link
Member Author

Run AsciidoctorRunner in this branch to test it: https://github.com/abelsromero/asciidoctorj-gradle/tree/issue_asciidoctorj_680

@robertpanzer
Copy link
Member

I just ran that class inside IntelliJ and it worked fine for me rendering the document 500 times.
I ran it in IntelliJ with Java 1.8.0_131 and these dependencies:
bildschirmfoto 2018-09-27 um 11 40 40
Anything else that I have to take care of?
I am definitely on the branch issue_asciidoctorj_680.

@abelsromero
Copy link
Member Author

Windows I guess.
I colleague just reproduced it with Windows 7 and JDK 1.8.0_111.
Exactly behavior as in my machine -> 9.1.16.0 fail, 9.1.17.0 works, I'll try on my Mac and Linux when I get home later.

@abelsromero
Copy link
Member Author

abelsromero commented Sep 28, 2018

I just reproduced on MacOS (JDK 8_181) and Manjaro Linux (JDK 8_181 and 10.0.2).

I ran it in IntelliJ with Java 1.8.0_131 and these dependencies:

Note the example sets jRuby to 9.1.17.0. Comment it to use the default provided by AsciidoctorJ (v16).

@abelsromero
Copy link
Member Author

I reproduced the issue in Travis and AppVeyour with the test should_render_the_same_document_a_100_times.

@abelsromero
Copy link
Member Author

Apologies to pushing this @robertpanzer , but I just to be sure AsciidoctorJ will upgrade to 9.1.17.0 as recommended version in include this in a hotfix for the maven plugin.
No need for a Asciidoctorj 1.5.7.1 release, but if we agree at least I can upgrade it in the maven side and if someone asks mention this is aligned with Asciidoctorj :%

@robertpanzer
Copy link
Member

I just reproduced the problem with Ruby 9.1.16.0.
Imo it makes sense to bump it to 9.1.17.0 if it doesn't produce other problems.
I can create a PR to bump the version and I'll merge your PR asap.

@abelsromero
Copy link
Member Author

Thanks! I will proceed with the maven changes.

@ancho
Copy link
Contributor

ancho commented Oct 10, 2018

As an addition. We ran into the same problem with the latest jbake release.
jbake-org/jbake.org#106

@abelsromero
Copy link
Member Author

I think we can close this issue. Even when not release, anyone with this issue just needs to use JRuby 9.1.17.0 instead of the version provided by AsciidoctorJ.

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

3 participants