Skip to content

fix(#297): make vocabulary thread-safe and return test-not-verb - #1227

Closed
VasilevNStas wants to merge 1 commit into
objectionary:masterfrom
VasilevNStas:fix/issue-297-thread-safe-test-not-verb
Closed

fix(#297): make vocabulary thread-safe and return test-not-verb#1227
VasilevNStas wants to merge 1 commit into
objectionary:masterfrom
VasilevNStas:fix/issue-297-thread-safe-test-not-verb

Conversation

@VasilevNStas

@VasilevNStas VasilevNStas commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

fix #297

Context. The unit-test-is-not-verb lint was disabled in #297 because it occasionally produced NullPointerException when the EO-to-Java Compiler ran lints in parallel. The maintainers agreed to re-enable it once a thread-safety fix lands (see the @todo #297 puzzle left in PkMono).

Root cause: OpenNLP's POSTaggerME is not thread-safe: a single shared instance mutates internal state (bestSequence) on every tag() call. Vocabulary kept one such instance and was invoked from multiple threads building eo-runtime with lints.

Fix:

  • Vocabulary now holds a shared POSModel (immutable, safe to reuse) and creates one POSTaggerME per thread via ThreadLocal, so concurrent calls never share mutable tagger state.
  • Re-enabled LtTestNotVerb (the unit-test-is-not-verb lint) in MonoLints, so it is back among the active default lints.
  • Removed the resolved @todo #297 from PkMono.

Tests: mvn clean install -Pqulice — 578 tests, all green, including the existing concurrent VocabularyTest, LtTestNotVerbTest, and lintsInMultipleThreads.

@volodya-lombrozo

Copy link
Copy Markdown
Member

Thanks for this! Rultor won't merge unsigned commits, and these aren't currently signed. Here's GitHub's doc on setting up commit signing: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits. Closing for now — reopen once signed and we can pick it back up.

@VasilevNStas

Copy link
Copy Markdown
Contributor Author

@volodya-lombrozo, fixed — commits are now SSH-signed (verified by GitHub). Since the closed PR can't be reopened after a force-push, I've recreated it as #1234 (same change, signed commits).

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.

LtTestNotVerb (with POSTaggerME) lint is not thread-safe

2 participants