redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.08k stars 438 forks source link

stream error while trying to build vscode-java@1.7.0 #2553

Open hyddel opened 2 years ago

hyddel commented 2 years ago

Getting Cannot call write after a stream was destroyed error while trying to use vscode-java@1.7.0 which I built locally

Environment
Steps To Reproduce

I have built vscode-java@1.7.0 locally by following the instructions here: https://github.com/redhat-developer/vscode-java/blob/v1.7.0/CONTRIBUTING.md

  1. For Client side setup, cloned the vscode-java and checked out to v1.7.0 and then ran npm install
  2. For Server side setup, just download the latest snapshot by running the command ./node_modules/.bin/gulp download_server
  3. Then ran vsce package which generated a .vsix file
  4. Trying to launch the built extension which results with the following error:
Current Result

plugins/redhat-java-features/extension/dist/extension.js:2:1044055 root ERROR [hosted-plugin: 15563] Promise rejection not handled in one second: Error: write EPIPE , reason: Error: write EPIPE With stack trace: Error: write EPIPE at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:94:16) root ERROR [hosted-plugin: 15563] Promise rejection not handled in one second: Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed , reason: Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed root ERROR [hosted-plugin: 15563] With stack trace: Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed at doWrite (_stream_writable.js:399:19) at writeOrBuffer (_stream_writable.js:387:5) at Socket.Writable.write (_stream_writable.js:318:11)

In addition, the extension keeps on loading without showing any syntax errors.

How to resolve this issue ? Please point me if I am building it incorrectly ?

jdneo commented 2 years ago

Do you have JDK 17 installed on your machine and set it as JAVA_HOME env variable?

hyddel commented 2 years ago

I am using Java 8

jdneo commented 2 years ago

It requires JDK 17 to launch the Language Server now. Could you try the step 5 of https://github.com/redhat-developer/vscode-java/blob/v1.7.0/CONTRIBUTING.md#a-client-side-setup. Or Download JDK 17 by yourself?

Qichar commented 2 years ago

@jdneo

You wrote that it requires JDK 17 to launch the Language Server now. However, with only Java 11 install on my local machine, I was able to host Theia running version 1.7.0 of the plugin (downloaded from the releases section). In fact, it seemed 1.7.0 requires 11 and 1.8.0 requires Java 17. (it complains about this in Theia if the version isn't high enough).

However, now for whatever reason I am getting this exact error with 1.7.0 after attempting to build my own. When I go back to the 1.7.0 downloaded from your website it also gives the above error now. I don't know how to fix it.

jdneo commented 2 years ago

@Qichar You need download the vsix with the platform name as its postfix. Like: redhat.java@linux-x64-1.8.0.vsix which self-contained a jre17 in the vsix file.

Qichar commented 2 years ago

@jdneo

Thank you for the reply. I tried downloading the platform specific version of 1.7.0 for Darwin Arm64 (which I think matches my Macbook Pro m1 processor). No good, same error. I tried upgrading the version of java on my machine (JDK) to java 17, and confirmed that it was runing the correct version. Still no good. Error is still as follows when I try to open a .jAVA file in Theia with the extension loaded. The extension can be seen in the list of plugins but the following error is shown in the console:

2022-07-19T17:49:22.374Z root ERROR [hosted-plugin: 39100] Promise rejection not handled in one second: Error: write EPIPE , reason: Error: write EPIPE 2022-07-19T17:49:22.375Z root ERROR [hosted-plugin: 39100] With stack trace: Error: write EPIPE at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:94:16) Promise rejection not handled in one second: Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed , reason: Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed With stack trace: Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed at doWrite (_stream_writable.js:399:19) at writeOrBuffer (_stream_writable.js:387:5) at Socket.Writable.write (_streamwritable.js:318:11) at /Users/komchang/WorkDir/AlternateProjects/cloud-shell-editor/browser-app/plugins/redhat-java-features/extension/dist/extension.js:2:1054691 at new Promise () at c.write (/Users/komchang/WorkDir/AlternateProjects/cloud-shell-editor/browser-app/plugins/redhat-java-features/extension/dist/extension.js:2:1054609) at .doWrite (/Users/komchang/WorkDir/AlternateProjects/cloud-shell-editor/browser-app/plugins/redhat-java-features/extension/dist/extension.js:2:1044160) at /Users/komchang/WorkDir/AlternateProjects/cloud-shell-editor/browser-app/plugins/redhat-java-features/extension/dist/extension.js:2:1044055