Skip to content

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

Open
VasilevNStas wants to merge 2 commits into
objectionary:masterfrom
VasilevNStas:fix/issue-297-thread-safe-test-not-verb
Open

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

Conversation

@VasilevNStas

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.

@VasilevNStas

Copy link
Copy Markdown
Contributor Author

@volodya-lombrozo @yegor256 plz review, I've fixed it

Comment thread src/main/java/org/eolang/lints/Vocabulary.java Outdated
Comment thread src/main/java/org/eolang/lints/MonoLints.java Outdated
Comment thread src/main/java/org/eolang/lints/MonoLints.java Outdated
Comment thread src/main/java/org/eolang/lints/Vocabulary.java Outdated
@VasilevNStas
VasilevNStas force-pushed the fix/issue-297-thread-safe-test-not-verb branch from 99576c9 to a25af68 Compare August 13, 2026 15:35
@VasilevNStas

Copy link
Copy Markdown
Contributor Author

@volodya-lombrozo I`m fixed it
plz re-review

@VasilevNStas
VasilevNStas force-pushed the fix/issue-297-thread-safe-test-not-verb branch from a25af68 to bfea148 Compare August 15, 2026 09:43
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