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

InvalidMarkExceptions thrown from BufferUtils #89

Closed
nbelisle11 opened this issue Jun 1, 2017 · 4 comments
Closed

InvalidMarkExceptions thrown from BufferUtils #89

nbelisle11 opened this issue Jun 1, 2017 · 4 comments

Comments

@nbelisle11
Copy link

nbelisle11 commented Jun 1, 2017

I tried to dig into this one but I can't figure out why this is happening based on source code analysis nor can I reliably reproduce it. It seems to be happening intermittently. Error & full stacktrace:
java.lang.RuntimeException: Could not check sentence (language: English (US)): 'mixture'

java.nio.InvalidMarkException: null
    at java.nio.Buffer.reset(Buffer.java:306)
    at morfologik.stemming.BufferUtils.charsToBytes(BufferUtils.java:177)
    at morfologik.speller.Speller.charSequenceToBytes(Speller.java:195)
    at morfologik.speller.Speller.isInDictionary(Speller.java:259)
    at morfologik.speller.Speller.isMisspelled(Speller.java:239)
    at org.languagetool.rules.spelling.morfologik.MorfologikSpeller.isMisspelled(MorfologikSpeller.java:86)
    at org.languagetool.rules.spelling.morfologik.MorfologikMultiSpeller.isMisspelled(MorfologikMultiSpeller.java:129)
    at org.languagetool.rules.spelling.morfologik.MorfologikSpellerRule.isMisspelled(MorfologikSpellerRule.java:157)
    at org.languagetool.rules.spelling.morfologik.MorfologikSpellerRule.getRuleMatches(MorfologikSpellerRule.java:178)
    at org.languagetool.rules.en.AbstractEnglishSpellerRule.getRuleMatches(AbstractEnglishSpellerRule.java:45)
    at org.languagetool.rules.spelling.morfologik.MorfologikSpellerRule.match(MorfologikSpellerRule.java:107)
    at org.languagetool.JLanguageTool.checkAnalyzedSentence(JLanguageTool.java:644)
    at org.languagetool.JLanguageTool$TextCheckCallable.call(JLanguageTool.java:991)
    at org.languagetool.JLanguageTool$TextCheckCallable.call(JLanguageTool.java:943)
    at org.languagetool.JLanguageTool.performCheck(JLanguageTool.java:606)
    at org.languagetool.JLanguageTool.check(JLanguageTool.java:558)
    at org.languagetool.JLanguageTool.check(JLanguageTool.java:508)
    at org.languagetool.JLanguageTool.check(JLanguageTool.java:504)

Might be related in some way to #75 and/or #90

@nbelisle11
Copy link
Author

@dweiss
Copy link
Member

dweiss commented Jun 2, 2017

Make sure speller is not used in a multi-threaded environment. Looks like you're calling it from multiple threads concurrently and it messes up internal buffers.

@dweiss dweiss closed this as completed Jun 2, 2017
@dweiss dweiss reopened this Jun 2, 2017
@dweiss
Copy link
Member

dweiss commented Jun 2, 2017

Let me know if this was indeed the case.

@nbelisle11
Copy link
Author

We are indeed using this in a multithreaded environment. I'll adjust and reopen if this doesn't resolve the issue. Thanks for the prompt response!

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

2 participants