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

(v2.5.x) Fixes #1158. Avoid concurrent initialization of Ruby wrapper class wh… #1173

Merged
merged 1 commit into from
Apr 15, 2023

Conversation

robertpanzer
Copy link
Member

…en converting to stream.

Thank you for opening a pull request and contributing to AsciidoctorJ!

Please take a bit of time giving some details about your pull request:

Kind of change

  • Bug fix
  • New non-breaking feature
  • New breaking feature
  • Documentation update
  • Build improvement

Description

What is the goal of this pull request?

Fix the issue reported in #1158.
When converting to a stream a new RubyClass is created lazily.
This step is not protected with a mutex, so that JRuby can fail.
This PR wants to fix this so that this exception does not occur when converting documents in parallel with one Asciidoctor instance.

How does it achieve that?

Eagerly create the class when initializing the Asciidoctor instance.

Are there any alternative ways to implement this?

Yes, the class could be created lazily and a mutex could guarantee mutual exclusion so that the class is created only once.

Are there any implications of this pull request? Anything a user must know?

Issue

Fixes #1157

Release notes

Please add a corresponding entry to the file CHANGELOG.adoc

@robertpanzer robertpanzer merged commit a7b12ea into asciidoctor:v2.5.x Apr 15, 2023
@robertpanzer robertpanzer deleted the fix-1158-v.2.5.x branch April 15, 2023 09:41
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

Successfully merging this pull request may close these issues.

1 participant