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

Invalid Header Format Causing JDTLS Failure with Eglot #3338

Open
LuciusChen opened this issue Dec 4, 2024 · 1 comment
Open

Invalid Header Format Causing JDTLS Failure with Eglot #3338

LuciusChen opened this issue Dec 4, 2024 · 1 comment

Comments

@LuciusChen
Copy link

LuciusChen commented Dec 4, 2024

I am experiencing an issue when using Eclipse JDT Language Server (jdtls) with Eglot in Emacs. The server fails with an "Invalid header format" error. Notably, this issue was not present in version 1.40.0. Below is the relevant error log:

[stderr]  [2024-12-04T06:33:41Z INFO  emacs_lsp_booster::app] Running server "/usr/bin/java" "-Declipse.application=org.eclipse.jdt.ls.core.id1" "-Dosgi.bundles.defaultStartLevel=4" "-Declipse.product=org.eclipse.jdt.ls.core.product" "-javaagent:/Users/luciuschen/.m2/repository/org/projectlombok/lombok/1.18.34/lombok-1.18.34.jar" "-Xmx8G" "-XX:+UseZGC" "-XX:+UseStringDeduplication" "-XX:+UseCompressedOops" "-jar" "/opt/homebrew/Cellar/jdtls/1.42.0/libexec/plugins/org.eclipse.equinox.launcher_1.6.900.v20240613-2009.jar" "-configuration" "/Users/luciuschen/.emacs.d/share/eclipse.jdt.ls/config_mac_arm/" "-data" "/Users/luciuschen/.emacs.d/cache/e6963f2dd67eb1d1b671f4820e0d5c99"
[stderr]  [2024-12-04T06:33:41Z INFO  emacs_lsp_booster::app] Will convert server json to bytecode! bytecode options: BytecodeOptions { object_type: Plist, null_value: Nil, false_value: Keyword("json-false") }
[stderr]  thread '<unnamed>' panicked at /github/workspace/src/app.rs:145:18:
[stderr]  called `Result::unwrap()` on an `Err` value: Server->client read thread failed
[stderr]  
[stderr]  Caused by:
[stderr]      Invalid header format
[stderr]  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

----------b---y---e---b---y---e----------
[stderr]  
[stderr]  
[stderr]  nil
[stderr]  nil
[stderr]  Process EGLOT (sky/(java-mode java-ts-mode)) stderr finished

Steps to Reproduce:

  1. Configure Eglot in Emacs to use jdtls.
  2. Start the language server with the provided Java command and options.
  3. Observe the error logs indicating a failure due to an "Invalid header format".

Additional Information:

  • JDTLS Version: 1.42.0
  • Java Version: (Java 11)
  • OS: macOS (ARM architecture)

Expected Behavior:

The jdtls server should start and function correctly without header format errors.

Actual Behavior:

The server crashes with an "Invalid header format" error, causing Eglot to fail.

Request for Assistance:

Any insights or suggestions to resolve this issue would be greatly appreciated. If additional logs or configuration details are needed, please let me know.

Thank you for your assistance!

@rgrunber
Copy link
Contributor

Is there any way to get more information regarding what was actually sent between the client and server ? Maybe it would be better to file the issue at https://github.com/joaotavora/eglot as they'd have better knowledge of how to debug it on the client end.

Would you happen to know if the language server is running over stdio, pipes, or a socket connection ? I really doubt that there's something in our use of lsp4j that isn't handled correctly. However, I have seen issues in the past where if some underlying librarby in the JDT-LS runtime attempts to write to stdout after the connection to the client has been established (while the language server is configured to communicate over stdin/stdout), then that might cause what you're seeing. It's actually why we switched to using pipes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants