languagetool.el icon indicating copy to clipboard operation
languagetool.el copied to clipboard

šŸ›Ā error in process filter: LanguageTool Server closed

Open ghost opened this issue 2 years ago • 5 comments

What version of Emacs are you running?

28.1

What version of LanguageTool are you running?

LanguageTool-6.0-stable

What version of this package are you running?

Version: 1.2.0

What is the current behaviour?

I can run the program in Console mode. However, when I try to run it in server mode, I get:

LanguageTool Server communication is up...
error in process filter: languagetool-server-highlight-matches: LanguageTool Server closed
error in process filter: LanguageTool Server closed

What is you expect to happen?

I expect the server to start.

What do you do to get this bug?

1. languagetool-server-start
2. languagetool-server-mode

ghost avatar Jan 31 '23 09:01 ghost

Can you please send me your package config and current OS?

PillFall avatar Feb 03 '23 19:02 PillFall

I am running it on Ubuntu 22.10

(setq languagetool-java-arguments '("-Dfile.encoding=UTF-8"))

(setq languagetool-console-command "/home/red/bin/languagetool/LanguageTool-6.0-stable/languagetool-commandline.jar"
      languagetool-server-command "/home/red/bin/languagetool/LanguageTool-6.0-stable/languagetool-server.jar")

(setq languagetool-api-key "password"
      languagetool-username "[email protected]")

ghost avatar Feb 07 '23 09:02 ghost

I'm unable to replicate your error. Check that the server start correctly in the buffer *LanguageTool Server Output*

PillFall avatar Mar 25 '23 04:03 PillFall

Error replication

PillFall avatar Mar 25 '23 04:03 PillFall

having the same issue, I get the following

Contacting host: localhost:8081
LanguageTool Server communication is up...
error in process filter: languagetool-server-highlight-matches: LanguageTool Server closed
error in process filter: LanguageTool Server closed

server output

2024-10-21 11:08:46.898 GMT+02:00 INFO  org.languagetool.server.DatabaseAccessOpenSource Not setting up database access, dbDriver is not configured
2024-10-21 09:08:46 +0000 Setting up thread pool with 10 threads
2024-10-21 11:08:47.614 GMT+02:00 WARN  org.languagetool.language.identifier.DefaultLanguageIdentifier fastText not configured - language detection performance will be degraded. See https://dev.languagetool.org/http-server#starting-from-command-line for instructions.
2024-10-21 11:08:47.617 GMT+02:00 INFO  org.languagetool.server.TextChecker A/B-Test enabled: []
2024-10-21 09:08:47 +0000 Starting LanguageTool 6.5 (build date: 2024-09-27 11:27:57 +0200, 5c6be17) server on http://localhost:8081...
2024-10-21 09:08:47 +0000 Server started
2024-10-21 11:08:51.829 GMT+02:00 INFO  org.languagetool.server.LanguageToolHttpHandler Handling GET /v2/languages
2024-10-21 11:08:51.873 GMT+02:00 INFO  org.languagetool.server.LanguageToolHttpHandler Handled request in 67ms; sending code 200
2024-10-21 11:08:55.014 GMT+02:00 INFO  org.languagetool.server.LanguageToolHttpHandler Handling POST /v2/check
2024-10-21 11:08:55.019 GMT+02:00 INFO  org.languagetool.server.LanguageToolHttpHandler An error has occurred: 'Could not decode query. Query length: 62407 Request method: POST', sending HTTP code 400. Access from 127.0.0.1, HTTP user agent: URL/Emacs Emacs/30.0.50 (TTY; x86_64-pc-linux-gnu), User agent param: null, Referrer: null, language: null, h: 1, r: 2, time: 4m: ALL, l: DEFAULT, Stacktrace follows:org.languagetool.server.BadRequestException: Could not decode query. Query length: 62407 Request method: POST
	at org.languagetool.server.LanguageToolHttpHandler.getParameterMap(LanguageToolHttpHandler.java:492)
	at org.languagetool.server.LanguageToolHttpHandler.parseQuery(LanguageToolHttpHandler.java:472)
	at org.languagetool.server.LanguageToolHttpHandler.getRequestQuery(LanguageToolHttpHandler.java:437)
	at org.languagetool.server.LanguageToolHttpHandler.handle(LanguageToolHttpHandler.java:169)
	at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:98)
	at jdk.httpserver/sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:82)
	at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:101)
	at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:871)
	at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:98)
	at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:847)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)

2024-10-21 11:08:55.019 GMT+02:00 INFO  org.languagetool.server.LanguageToolHttpHandler Handled request in 5ms; sending code 400

bjfer avatar Oct 21 '24 08:10 bjfer

Same issue here. Has it been solved or bypassed? Languagetool, outside of emacs, seems to work as expected.

If not, and bear with me because I almost know nothing about elisp, I think I narrowed it down to the line 317 of languagetool-server.el. For some reason, 'url-http-response-status is not populated and let void when the function languagetool-server-highlight-matches is called. Nontheless, the function languagetool-server-send-request, which uses the languagetool-server-highlight-matches function, works without problem.

I don't know if that is helpful or evident, but with current knowledge I have I got as far as I could.

jcintasr avatar Sep 22 '25 15:09 jcintasr

Could you (@jcintasr), provide me with the info about your installation? I was trying to replicate this issues, but nothing seems to be wrong.

The issue is still present, but seems to be sporadic or specific to a configuration.

This issue seems related to #26.

PillFall avatar Sep 24 '25 15:09 PillFall

From @bjfer logs, I truly believe this is related to #26. This should be fixed now.

Please confirm if that's the case.

If installed from MELPA, patch is only available in unstable branch, I want to check on all versions before publishing to stable

PillFall avatar Sep 24 '25 18:09 PillFall

Ok, it is fixed. Thanks a lot!

Only for reference, this is my setup:

  • Emacs version: 30.2
  • Java version: 6.6-2
  • And my current configuration:
  (use-package languagetool
    :ensure t
    :defer t
    :commands (languagetool-check
  	       languagetool-clear-suggestions
  	       languagetool-correct-at-point
  	       languagetool-correct-buffer
  	       languagetool-set-language
  	       languagetool-server-mode
  	       languagetool-server-start
  	       languagetool-server-stop)
    :config
    
    (setq languagetool-java-arguments '(
  	    "-Dfile.encoding=UTF-8"
  	    "-cp" "/usr/share/languagetool:/usr/share/java/languagetool/*"
  	    )
  	languagetool-java-bin "/usr/lib/jvm/java-17-openjdk/bin/java"
  	languagetool-console-command "org.languagetool.commandline.Main"
  	languagetool-server-command "org.languagetool.server.HTTPServer"
  	)
    )

jcintasr avatar Sep 25 '25 05:09 jcintasr