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

Error loading shared library libhunspell.so: No such file or directory #66

Closed
starapo7348 opened this issue Feb 25, 2023 · 6 comments
Closed
Assignees

Comments

@starapo7348
Copy link

starapo7348 commented Feb 25, 2023

I am trying to use the languagetool to check the spelling in a webform (language is de-de). Spelling mistake deise -> diese. The result is the following server error:

languagetool  | 	at org.languagetool.JLanguageTool.performCheck(JLanguageTool.java:1298)
languagetool  | 	at org.languagetool.JLanguageTool.checkInternal(JLanguageTool.java:991)
languagetool  | 	at org.languagetool.JLanguageTool.check2(JLanguageTool.java:918)
languagetool  | 	at org.languagetool.server.TextChecker.getPipelineResults(TextChecker.java:802)
languagetool  | 	at org.languagetool.server.TextChecker.getRuleMatches(TextChecker.java:751)
languagetool  | 	at org.languagetool.server.TextChecker.lambda$checkText$5(TextChecker.java:472)
languagetool  | 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
languagetool  | 	... 3 more
languagetool  | Caused by: java.lang.RuntimeException: Could not check sentence (language: German (Germany)): <sentcontent>deise</sentcontent>
languagetool  | 	at org.languagetool.JLanguageTool$TextCheckCallable.getOtherRuleMatches(JLanguageTool.java:1993)
languagetool  | 	at org.languagetool.JLanguageTool$TextCheckCallable.call(JLanguageTool.java:1866)
languagetool  | 	at org.languagetool.JLanguageTool$TextCheckCallable.call(JLanguageTool.java:1833)
languagetool  | 	at org.languagetool.JLanguageTool.performCheck(JLanguageTool.java:1294)
languagetool  | 	... 9 more
languagetool  | Caused by: java.lang.RuntimeException: Could not create hunspell instance. Please note that LanguageTool supports only 64-bit platforms (Linux, Windows, Mac) and that it requires a 64-bit JVM (Java).
languagetool  | 	at org.languagetool.rules.spelling.hunspell.DumontsHunspellDictionary.<init>(DumontsHunspellDictionary.java:35)
languagetool  | 	at org.languagetool.rules.spelling.hunspell.Hunspell.getDictionary(Hunspell.java:46)
languagetool  | 	at org.languagetool.rules.spelling.hunspell.HunspellRule.init(HunspellRule.java:584)
languagetool  | 	at org.languagetool.rules.de.GermanSpellerRule.init(GermanSpellerRule.java:1557)
languagetool  | 	at org.languagetool.rules.spelling.hunspell.HunspellRule.ensureInitialized(HunspellRule.java:558)
languagetool  | 	at org.languagetool.rules.spelling.hunspell.HunspellRule.match(HunspellRule.java:220)
languagetool  | 	at org.languagetool.rules.de.GermanSpellerRule.match(GermanSpellerRule.java:1475)
languagetool  | 	at org.languagetool.JLanguageTool.checkAnalyzedSentence(JLanguageTool.java:1370)
languagetool  | 	at org.languagetool.JLanguageTool.access$1500(JLanguageTool.java:74)
languagetool  | 	at org.languagetool.JLanguageTool$TextCheckCallable.getOtherRuleMatches(JLanguageTool.java:1950)
languagetool  | 	... 12 more
languagetool  | Caused by: java.lang.UnsatisfiedLinkError: Unable to load library 'hunspell':
languagetool  | Error loading shared library libhunspell.so: No such file or directory
languagetool  | Error loading shared library libhunspell.so: No such file or directory
languagetool  | Native library (linux-aarch64/libhunspell.so) not found in resource path (languagetool-server.jar)
languagetool  | 	at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:307)
languagetool  | 	at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:467)
languagetool  | 	at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:409)
languagetool  | 	at dumonts.hunspell.bindings.HunspellLibrary.<clinit>(HunspellLibrary.java:16)
languagetool  | 	at dumonts.hunspell.Hunspell.<init>(Hunspell.java:21)
languagetool  | 	at org.languagetool.rules.spelling.hunspell.DumontsHunspellDictionary.<init>(DumontsHunspellDictionary.java:33)
languagetool  | 	... 21 more
languagetool  | 	Suppressed: java.lang.UnsatisfiedLinkError: Error loading shared library libhunspell.so: No such file or directory
languagetool  | 		at com.sun.jna.Native.open(Native Method)
languagetool  | 		at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:197)
languagetool  | 		... 26 more
languagetool  | 	Suppressed: java.lang.UnsatisfiedLinkError: Error loading shared library libhunspell.so: No such file or directory
languag

System: Raspberry PI4 arm64; Linux 6.0.0-5-arm64 #1 SMP Debian 6.0.10-2 (2022-12-01) aarch64 GNU/Linux
Docker Image: image: erikvl87/languagetool:latest

What's wrong here? Why is libhunspell.so not loaded? It is present in /LanguageTool/libs/hunspell.jar

@Erikvl87 Erikvl87 self-assigned this Mar 9, 2023
@Erikvl87
Copy link
Owner

Erikvl87 commented Mar 9, 2023

This may be related to the arm64-workaround that's in place (see #15 and #53 for more information). I will try to reproduce your issue on my own raspberry PI.

@Erikvl87
Copy link
Owner

Erikvl87 commented Mar 9, 2023

I have it reproduced. I do need some time to figure out how to fix this. I'll get back to you asap.

@Erikvl87
Copy link
Owner

Erikvl87 commented Mar 15, 2023

Hi @starapo7348 and @tivaliy (#67),

A fix has been merged and is released in 6.0-dockerupdate-4 / latest.
Could you both test if your issues have been resolved with this new release? Please let me know so we can close this issue.

@tivaliy
Copy link

tivaliy commented Mar 16, 2023

Hi @Erikvl87 , thank you for your time and hard work.

Seems it works for me fine.

The only thing that I wanted to ask you. I faced with another issue (maybe even not related to Docker image itself, but to LanguageTool configuration).

So here is example of making API request to the public API with language auto and short text Ok..
As you can see it works:

curl -X POST -d "text=Ok." -d "language=auto" https://api.languagetool.org/v2/check

{"software":{"name":"LanguageTool","version":"6.1-SNAPSHOT","buildDate":"2023-03-15 17:45:09 +0000","apiVersion":1,"premium":true,"premiumHint":"You might be missing errors only the Premium version can find. Contact us at support<at>languagetoolplus.com.","status":""},"warnings":{"incompleteResults":false},"language":{"name":"English (US)","code":"en-US","detectedLanguage":{"name":"English (US)","code":"en-US","confidence":0.099,"source":"ngram"}},"matches":[],"sentenceRanges":[[0,3]]}

but I got timout when running the same request to a locally runing LanguageTool instance:

curl -X POST -d "text=Ok." -d "language=auto" http://localhost:8010/v2/check --max-time 10

curl: (28) Operation timed out after 10003 milliseconds with 0 bytes received

@Erikvl87
Copy link
Owner

Great that it is not crashing anymore for you, @tivaliy. I'll also await the original issue author @starapo7348 before closing down this ticket.

but I got timout when running the same request to a locally runing LanguageTool instance:

Hunspell performance is very slow, especially the first request. On my Raspberry Pi 4, the first request took 30 to 40 seconds. After that, things got a bit faster for me. I would propose that you extend the timeout for your first request (--max-time 60), or play with the Java heap size and LanguageTool HTTPServerConfig settings (like lang_pipelinePrewarming).

LanguageTool supports spell checking using hunspell via BridJ (thanks to hunspell-java). Unfortunately, the Hunspell performance of creating suggestions is very low.

Source: https://dev.languagetool.org/hunspell-support.html

If you have other questions regarding this matter, please open up a new ticket here if you think it is Docker related, or here if it is related to LanguageTool itself.

@starapo7348
Copy link
Author

Looks good now. :) It did not crash anymore. Thanks @Erikvl87 for fixing the issue. Nice work.


languagetool  | 2023-03-16 19:19:22 +0000 Starting LanguageTool 6.0 (build date: 2023-03-15 23:31:24 +0000, e44dbb0) server on http://localhost:8010...
languagetool  | 2023-03-16 19:19:22 +0000 Server started
languagetool  | 2023-03-16 19:19:41.418 +0000 INFO  org.languagetool.server.LanguageToolHttpHandler Handling POST /v2/check
languagetool  | 2023-03-16 19:19:53.874 +0000 INFO  org.languagetool.server.LanguageToolHttpHandler Handling POST /v2/check
languagetool  | 2023-03-16 19:19:53.880 +0000 INFO  org.languagetool.server.LanguageToolHttpHandler Handling POST /v2/check
languagetool  | 2023-03-16 19:19:54.750 +0000 WARN  org.languagetool.language.identifier.DefaultLanguageIdentifier Cannot consider noopLanguages because not in fastText mode: [de, en]
languagetool  | 2023-03-16 19:19:54.752 +0000 WARN  org.languagetool.language.identifier.DefaultLanguageIdentifier Cannot consider noopLanguages because not in fastText mode: [de, en]
languagetool  | 2023-03-16 19:20:00.602 +0000 INFO  org.languagetool.server.TextChecker Check done: 13 chars, en-US, requestId: null, #1, null, 0/1 matches, 19062ms, agent:-, sent, q:0, h:3, dH:2, r:3, m:all, premium: false
languagetool  | 2023-03-16 19:20:00.606 +0000 INFO  org.languagetool.server.LanguageToolHttpHandler Handled request in 19220ms; sending code 200
languagetool  | 2023-03-16 19:20:20.370 +0000 INFO  org.languagetool.server.TextChecker Check done: 5 chars, de-DE (mother tongue: de)[auto], requestId: null, #1, null, 0/0 matches, 25617ms, agent:webextension-firefox-ng, version: 6.2.2, sent, q:0, h:2, dH:1, r:3, m:tlo, premium: false
languagetool  | 2023-03-16 19:20:20.371 +0000 INFO  org.languagetool.server.LanguageToolHttpHandler Handled request in 26497ms; sending code 200
languagetool  | 2023-03-16 19:20:21.543 +0000 INFO  org.languagetool.server.LanguageToolHttpHandler Handling POST /v2/check
languagetool  | 2023-03-16 19:20:21.853 +0000 INFO  org.languagetool.server.TextChecker Check done: 13 chars, en-US, requestId: null, #2, null, 0/1 matches, 303ms, agent:-, sent, q:0, h:2, dH:2, r:4, m:all, premium: false
languagetool  | 2023-03-16 19:20:21.863 +0000 INFO  org.languagetool.server.LanguageToolHttpHandler Handled request in 320ms; sending code 200
languagetool  | 2023-03-16 19:20:32.282 +0000 INFO  org.languagetool.server.TextChecker Check done: 5 chars, de-DE (mother tongue: de)[auto], requestId: null, #1, null, 0/1 matches, 37532ms, agent:webextension-firefox-ng, version: 6.2.2, sent, q:0, h:1, dH:1, r:4, m:!tlo, premium: false
languagetool  | 2023-03-16 19:20:32.284 +0000 INFO  org.languagetool.server.LanguageToolHttpHandler Handled request in 38404ms; sending code 200
languagetool  | 2023-03-16 19:20:44.115 +0000 INFO  org.languagetool.server.LanguageToolHttpHandler Handling POST /v2/check
languagetool  | 2023-03-16 19:20:44.118 +0000 INFO  org.languagetool.server.LanguageToolHttpHandler Handling POST /v2/check
languagetool  | 2023-03-16 19:20:44.120 +0000 WARN  org.languagetool.language.identifier.DefaultLanguageIdentifier Cannot consider noopLanguages because not in fastText mode: [de, en]
languagetool  | 2023-03-16 19:20:44.123 +0000 WARN  org.languagetool.language.identifier.DefaultLanguageIdentifier Cannot consider noopLanguages because not in fastText mode: [de, en]
languagetool  | 2023-03-16 19:20:44.551 +0000 INFO  org.languagetool.server.TextChecker Check done: 5 chars, de-DE (mother tongue: de)[auto], requestId: null, #2, null, 0/0 matches, 431ms, agent:webextension-firefox-ng, version: 6.2.2, sent, q:0, h:2, dH:1, r:6, m:tlo, premium: false
languagetool  | 2023-03-16 19:20:44.551 +0000 INFO  org.languagetool.server.LanguageToolHttpHandler Handled request in 436ms; sending code 200
languagetool  | 2023-03-16 19:20:46.594 +0000 INFO  org.languagetool.server.TextChecker Check done: 5 chars, de-DE (mother tongue: de)[auto], requestId: null, #2, null, 0/0 matches, 2472ms, agent:webextension-firefox-ng, version: 6.2.2, sent, q:0, h:1, dH:1, r:6, m:!tlo, premium: false
languagetool  | 2023-03-16 19:20:46.595 +0000 INFO  org.languagetool.server.LanguageToolHttpHandler Handled request in 2477ms; sending code 200
languagetool  | 2023-03-16 19:20:52.020 +0000 INFO  org.languagetool.server.LanguageToolHttpHandler Handling POST /v2/check
languagetool  | 2023-03-16 19:20:52.157 +0000 INFO  org.languagetool.server.TextChecker Check done: 13 chars, en-US, requestId: null, #3, null, 0/1 matches, 135ms, agent:-, sent, q:0, h:1, dH:1, r:7, m:all, premium: false
languagetool  | 2023-03-16 19:20:52.158 +0000 INFO  org.languagetool.server.LanguageToolHttpHandler Handled request in 138ms; sending code 200
languagetool  | 2023-03-16 19:21:22.325 +0000 INFO  org.languagetool.server.LanguageToolHttpHandler Handling POST /v2/check
languagetool  | 2023-03-16 19:21:22.463 +0000 INFO  org.languagetool.server.TextChecker Check done: 13 chars, en-US, requestId: null, #4, null, 0/1 matches, 134ms, agent:-, sent, q:0, h:1, dH:1, r:8, m:all, premium: false
languagetool  | 2023-03-16 19:21:22.464 +0000 INFO  org.languagetool.server.LanguageToolHttpHandler Handled request in 140ms; sending code 200
languagetool  | 2023-03-16 19:21:52.650 +0000 INFO  org.languagetool.server.LanguageToolHttpHandler Handling POST /v2/check
languagetool  | 2023-03-16 19:21:52.797 +0000 INFO  org.languagetool.server.TextChecker Check done: 13 chars, en-US, requestId: null, #5, null, 0/1 matches, 144ms, agent:-, sent, q:0, h:1, dH:1, r:9, m:all, premium: false
languagetool  | 2023-03-16 19:21:52.798 +0000 INFO  org.languagetool.server.LanguageToolHttpHandler Handled request in 148ms; sending code 200

You can close the issue now. Another one fixed! :)

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