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

IOException when closing files on Linux #400

Closed
Jonathan-Maciel opened this issue May 10, 2023 · 14 comments
Closed

IOException when closing files on Linux #400

Jonathan-Maciel opened this issue May 10, 2023 · 14 comments
Labels
bug Something isn't working language client language server integration should-fix SVT

Comments

@Jonathan-Maciel
Copy link

Liberty Tools Version: 0.0.9-SNAPSHOT
IntelliJ Version: 2023.1.1
OS: Ubuntu 22.04.2 LTS
Observed with several different SDKs and language level combinations.

This error message appears when closing a file in the IDE.
Screenshot 2023-05-10 at 1 36 48 PM
Screenshot 2023-05-10 at 1 34 56 PM

@Jonathan-Maciel Jonathan-Maciel added bug Something isn't working SVT labels May 10, 2023
@TrevCraw
Copy link
Contributor

@Jonathan-Maciel how often does this occur? Is it on every file being closed? Certain types of files? Intermittent?

@Jonathan-Maciel
Copy link
Author

@TrevCraw I have noticed it with closing java and server.xml files. It happens frequently, but the same file can close without error and then this happens just a moment later. I haven't been able to determine a pattern.

The ide logs have some more info about what was happening just before the error:

May 11, 2023 7:53:25 AM org.eclipse.lsp4jakarta.commons.JakartaEESnippetRegistryLoader load
INFO: Loading snippets into registry...
May 11, 2023 7:53:25 AM org.eclipse.lsp4mp.ls.MicroProfileLanguageServer initialize
INFO: Initializing MicroProfile server 0.6.0-20221201-1617 with /root/Downloads/idea-IU-231.8770.65/jbr
May 11, 2023 7:53:26 AM org.eclipse.lsp4jakarta.JakartaLanguageServer initialize
INFO: Initializing Jakarta EE server
2023-05-11 07:53:30,217 [  95856] SEVERE - org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor - java.io.IOException: Stream closed
org.eclipse.lsp4j.jsonrpc.JsonRpcException: java.io.IOException: Stream closed
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:122)
	at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.io.IOException: Stream closed
	at java.base/java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:168)
	at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:267)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:79)
	... 6 more

@turkeylurkey
Copy link
Member

Say you open five Java files and then close them one by one. Does the exception happen for all of them or only for the fifth one?

@angelozerr
Copy link

I suspect that it is again a problem of start/stop language server.

I aligned this feature with LSP4E and fix a lot of problems in redhat-developer/intellij-quarkus#849 it is a draft for the moment.

@Jonathan-Maciel
Copy link
Author

Looking at the logs, an exception is also happening when opening each new file. It's just not being alerted to the ui as an error.

May 11, 2023 9:14:05 AM org.eclipse.lsp4jakarta.commons.JakartaEESnippetRegistryLoader load
INFO: Loading snippets into registry...
May 11, 2023 9:14:06 AM org.eclipse.lsp4jakarta.JakartaLanguageServer initialize
INFO: Initializing Jakarta EE server
2023-05-11 09:14:10,156 [ 499192]   WARN - io.openliberty.tools.intellij.lsp4mp.lsp4ij.LanguageServerWrapper - null
java.util.concurrent.TimeoutException
	at java.base/java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1960)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2095)
	at io.openliberty.tools.intellij.lsp4mp.lsp4ij.LanguageServerWrapper.lambda$stop$10(LanguageServerWrapper.java:392)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
2023-05-11 09:14:10,157 [ 499193]   WARN - io.openliberty.tools.intellij.lsp4mp.lsp4ij.LanguageServerWrapper - java.io.IOException: Stream closed
org.eclipse.lsp4j.jsonrpc.JsonRpcException: java.io.IOException: Stream closed
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageConsumer.consume(StreamMessageConsumer.java:72)
	at io.openliberty.tools.intellij.lsp4mp.lsp4ij.LanguageServerWrapper.lambda$start$1(LanguageServerWrapper.java:192)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.notify(RemoteEndpoint.java:126)
	at org.eclipse.lsp4j.jsonrpc.services.EndpointProxy.invoke(EndpointProxy.java:88)
	at jdk.proxy9/jdk.proxy9.$Proxy165.exit(Unknown Source)
	at io.openliberty.tools.intellij.lsp4mp.lsp4ij.LanguageServerWrapper.lambda$stop$10(LanguageServerWrapper.java:405)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: java.io.IOException: Stream closed
	at java.base/java.lang.ProcessBuilder$NullOutputStream.write(ProcessBuilder.java:445)
	at java.base/java.io.OutputStream.write(OutputStream.java:162)
	at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
	at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageConsumer.consume(StreamMessageConsumer.java:69)
	... 12 more

@TrevCraw
Copy link
Contributor

@Jonathan-Maciel could you please try out this scenario suggested by @turkeylurkey ?

Say you open five Java files and then close them one by one. Does the exception happen for all of them or only for the fifth one?

@Jonathan-Maciel
Copy link
Author

@TrevCraw Sorry, I meant my last comment to be in response to that suggestion. I saw the above exception by monitoring the logs when opening multiple files. No error alerts were triggered in the ui for this and I didn't see it when closing any of the files.

@dshimo
Copy link
Contributor

dshimo commented May 12, 2023

I was able to recreate the bug on Linux, but not on Mac.

@angelozerr
Copy link

Please wait for I finish redhat-developer/intellij-quarkus#849 and you integrate it. I suspect it is a problem with stop of language server.

@anusreelakshmi934
Copy link
Contributor

anusreelakshmi934 commented Jul 9, 2024

Tested using the latest lsp4ij feature branch (version - 0.0.2) . I was not able to reproduce the error. No error message appears when closing a file in the IDE. I tried with closing java and server.xml files.

Screen.Recording.2024-07-09.at.4.27.17.PM.mov

@TrevCraw
Copy link
Contributor

TrevCraw commented Jul 10, 2024

Hi @anusreelakshmi934 thank you for sharing your results. Could you please search through the logs after testing this scenario just to confirm there are no hidden/suppressed exceptions?

@anusreelakshmi934
Copy link
Contributor

Hi @anusreelakshmi934 thank you for sharing your results. Could you please search through the logs after testing this scenario just to confirm there are no hidden/suppressed exceptions?

@TrevCraw I looked into the logs as well. Did not find any IOExceptions.

@turkeylurkey turkeylurkey changed the title IOException when closing files IOException when closing files on Linux Jul 24, 2024
@TrevCraw
Copy link
Contributor

Hi @anusreelakshmi934 , could you please try recreating this issue using a Linux machine?

@anusreelakshmi934
Copy link
Contributor

Hi @TrevCraw . Tested on a Linux machine and could not reproduce the issue. The exception appears to originate from org.eclipse.lsp4j and io.openliberty.tools.intellij.lsp4mp.lsp4ij. We tested using the latest Red Hat LSP4IJ, so this doesn't seem to be an issue with Red Hat LSP4IJ.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working language client language server integration should-fix SVT
Projects
None yet
Development

No branches or pull requests

6 participants