adoptium / adoptium-support

For end-user problems reported with our binary distributions
Apache License 2.0
44 stars 15 forks source link

[vscode devcontainer]A fatal error has been detected by the Java Runtime Environment #1108

Open zanqi opened 3 weeks ago

zanqi commented 3 weeks ago

Please provide a brief summary of the bug

I use vscode devcontainer on a java project. Got the following error for the past month and couldn't get IntelliSense for java. Log file attached. hs_err_pid939.log

Did you test with the latest update version?

Please provide steps to reproduce where possible

  1. install docker desktop
  2. clone the repo: https://github.com/zanqi/compiler
  3. open it in vscode
  4. vscode should popup a prompt on bottom right to open It in devcontainer. Click blue button to do so
  5. after things settled (no more in progress UI on the screen), open a java file
  6. "java: initialize workspace" in the bottom bar appears, but never finished. Click on it will see the error I am reporting.

Expected Results

no error

Actual Results

as reported

What Java Version are you using?

openjdk 21.0.3 2024-04-16 LTS OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode, sharing)

What is your operating system and platform?

Ubuntu 24.04 LTS on amd64

How did you install Java?

vscode devcontainer, select java in select container features

image

Did it work before?

Yes, used to work a month ago

Did you test with other Java versions?

No

Relevant log output

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007ffffeec3a2d, pid=939, tid=991
#
# JRE version: OpenJDK Runtime Environment Temurin-17.0.11+9 (17.0.11+9) (build 17.0.11+9)
# Java VM: OpenJDK 64-Bit Server VM Temurin-17.0.11+9 (17.0.11+9, mixed mode, tiered, compressed oops, compressed class ptrs, parallel gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xc87a2d]  void OopOopIterateDispatch<PCIterateMarkAndPushClosure>::Table::oop_oop_iterate<InstanceKlass, narrowOop>(PCIterateMarkAndPushClosure*, oopDesc*, Klass*)+0xdd
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /workspaces/compiler/hs_err_pid939.log
#
# If you would like to submit a bug report, please visit:
#   https://github.com/adoptium/adoptium-support/issues
#
[Error - 11:32:36 PM] Client Language Support for Java (Syntax Server): connection to server is erroring. Shutting down server.
[Error - 11:32:36 PM] Client Language Support for Java (Syntax Server): connection to server is erroring. Shutting down server.
[Error - 11:32:36 PM] Stopping server failed
  Message: Cannot call write after a stream was destroyed
  Code: -32099
karianna commented 3 weeks ago

Might be related to #1094 as well.

karianna commented 3 weeks ago

@zanqi It looks like that you have both Java 21.0.3 installed and 17.0.11. Is it the case that VS Code starts with 21 but you are targeting 17 for that project?

zanqi commented 3 weeks ago

@karianna I don't have jdk 17 installed, but the redhat java extension for vscode comes with an embedded JDK 17.

akaroml commented 3 weeks ago

@testforstephen could you help take a look?

akaroml commented 3 weeks ago

@karianna I don't have jdk 17 installed, but the redhat java extension for vscode comes with an embedded JDK 17.

Just to clarify that the embedded JDK is for the language service internal use only. User still needs to install the JDK corresponding to their project needs.

testforstephen commented 3 weeks ago

Hey @zanqi, I followed your reproducing steps and Java extension is started well using the embedded JRE 17. See the screenshot below.

image

The embedded JRE of Java extension is from JustJ (which is based on Temurin), I'm not familiar with the specific JDK errors. Can you try to change the user setting "java.jdt.ls.java.home": "/usr/local/sdkman/candidates/java/21.0.3-tem"? This will force the Java extension to use your specified JDK to start the Java tooling.

zanqi commented 3 weeks ago

Hi, @testforstephen, the setting key "java.jdt.ls.java.home" is not recognized by vscode. One difference between our setup is I am using vscode on a mac.

image
testforstephen commented 3 weeks ago

F1 -> Preferences: Open User Settings

image

Yes, I run docker on Windows 11. Can you share specific info for your macOS machine?

zanqi commented 2 weeks ago

Thanks for the instruction. I changed the Remote settings accordingly. Unfortunately, the problem still appears. Only this time, the error is reported by JDK 21

My mac info: Chip: Apple M3 Pro OS: macOS Sonama Version 14.5

The error:

[thread 8687 also had an error]
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007ffffed93690, pid=8670, tid=8672
#
# JRE version: OpenJDK Runtime Environment Temurin-21.0.3+9 (21.0.3+9) (build 21.0.3+9-LTS)
# Java VM: OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (21.0.3+9-LTS, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, parallel gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xd7c690]  oopDesc* PSPromotionManager::copy_unmarked_to_survivor_space<false>(oopDesc*, markWord)+0x40
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /workspaces/compiler/hs_err_pid8670.log
[thread 8688 also had an error]
#
# If you would like to submit a bug report, please visit:
#   https://github.com/adoptium/adoptium-support/issues
#
testforstephen commented 2 weeks ago

I noticed that your image is for AMD64 (x64), but your machine uses Apple Silicon. Was this intentional? Have you tried using the ARM64 image?

zanqi commented 2 weeks ago

Yes, some of the packages I need are compiled for i386. It only works on AMD64 but not ARM64.

I tried switching the image to ARM64. The Java language server indeed works.

testforstephen commented 2 weeks ago

So this is a platform compatibility issue. let's narrow it down a bit. Can you manually run Java command on the devcontainer? for example, javac Hello.java and java Hello. I want to confirm if the problem is with the JDK itself or with the Java extension.

zanqi commented 2 weeks ago

javac and java commands work fine. Only the Java extension is having trouble.

testforstephen commented 2 weeks ago

Did it work before? Yes, used to work a month ago

@zanqi Do you know from which version of vscode-java the issue starts occurring?

@rgrunber The user is running dev container with Ubuntu x64 image on Apple M3 Pro (arm64), and Java extension fails to start. Any thoughts on this issue?

Edited: Used to work a month ago, so the issue likely started with vscode-java version 1.31.0.

zanqi commented 2 weeks ago

I don't know the last working version.