quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.77k stars 2.68k forks source link

EXCEPTION_ACCESS_VIOLATION error occurs when running 'quarkus dev' on Windows #34382

Open ddoehlin opened 1 year ago

ddoehlin commented 1 year ago

Describe the bug

When starting Quarkus with the command

quarkus dev

in a Windows 10/11 command line interface (CMD or PowerShell), an error occurs related to Jansi library. The error specifically mentions an EXCEPTION_ACCESS_VIOLATION in the Java Runtime Environment (JRE). This issue does not occur when running under Linux, when using the Git-Bash or when starting Quarkus via Gradle (./gradlew quarkusDev).

Expected behavior

No JVM crash.

Actual behavior

After successfully building the application, the VM crashes when starting the Quarkus shell, resulting in an EXCEPTION_ACCESS_VIOLATION error. The attached core dump file shows that the error originates from the Jansi library and occurs during a native call.

hs_err_pid2300.log

from above:


---------------  T H R E A D  ---------------

Current thread (0x000001ba71894ab0):  JavaThread "build-62" [_thread_in_vm, id=10592, stack(0x000000518a500000,0x000000518a600000)]

Stack: [0x000000518a500000,0x000000518a600000],  sp=0x000000518a5fd890,  free space=1014k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [jvm.dll+0x43f8df]
C  [jansi.dll+0x104e]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.fusesource.jansi.internal.CLibrary.init()V+0
j  org.fusesource.jansi.internal.CLibrary.<clinit>()V+12
v  ~StubRoutines::call_stub 0x000001ba5d13100e
j  org.fusesource.jansi.AnsiConsole.ansiStream(Z)Lorg/fusesource/jansi/AnsiPrintStream;+62
j  org.fusesource.jansi.AnsiConsole.initStreams()V+7
j  org.fusesource.jansi.AnsiConsole.out()Lorg/fusesource/jansi/AnsiPrintStream;+0
j  org.aesh.readline.terminal.impl.WinSysTerminal.<init>(Ljava/lang/String;ZLorg/aesh/terminal/Terminal$SignalHandler;)V+4
j  org.aesh.readline.terminal.impl.WinSysTerminal.<init>(Ljava/lang/String;Z)V+6
j  org.aesh.readline.terminal.TerminalBuilder.createWindowsTerminal(Ljava/lang/String;)Lorg/aesh/terminal/Terminal;+15
j  org.aesh.readline.terminal.TerminalBuilder.build()Lorg/aesh/terminal/Terminal;+125
j  org.aesh.readline.tty.terminal.TerminalConnection.<init>(Ljava/nio/charset/Charset;Ljava/nio/charset/Charset;Ljava/io/InputStream;Ljava/io/OutputStream;Ljava/util/function/Consumer;)V+85
j  org.aesh.readline.tty.terminal.TerminalConnection.<init>(Ljava/util/function/Consumer;)V+14
j  io.quarkus.deployment.console.ConsoleHelper.installConsole(Lio/quarkus/deployment/dev/testing/TestConfig;Lio/quarkus/deployment/console/ConsoleConfig;Lio/quarkus/runtime/console/ConsoleRuntimeConfig;Lio/quarkus/runtime/logging/ConsoleConfig;Z)V+95
j  io.quarkus.deployment.console.ConsoleProcessor.setupConsole(Lio/quarkus/deployment/dev/testing/TestConfig;Lio/quarkus/deployment/annotations/BuildProducer;Lio/quarkus/deployment/builditem/LaunchModeBuildItem;Lio/quarkus/deployment/console/ConsoleConfig;)Lio/quarkus/deployment/console/ConsoleInstalledBuildItem;+101
j  java.lang.invoke.LambdaForm$DMH+0x0000000801219800.invokeVirtual(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+18 java.base@19.0.2
j  java.lang.invoke.LambdaForm$MH+0x0000000801221000.invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+143 java.base@19.0.2
J 920 c1 java.lang.invoke.Invokers$Holder.invokeExact_MT(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; java.base@19.0.2 (24 bytes) @ 0x000001ba5d4d263c [0x000001ba5d4d2560+0x00000000000000dc]
J 818 c1 java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; java.base@19.0.2 (108 bytes) @ 0x000001ba5d4a99ac [0x000001ba5d4a91a0+0x000000000000080c]
j  io.quarkus.deployment.ExtensionLoader$3.execute(Lio/quarkus/builder/BuildContext;)V+265
j  io.quarkus.builder.BuildContext.run()V+70
j  io.quarkus.builder.BuildContext$$Lambda$255+0x00000008011ce898.run()V+4
j  org.jboss.threads.ContextHandler$1.runWith(Ljava/lang/Runnable;Ljava/lang/Object;)V+1
j  org.jboss.threads.EnhancedQueueExecutor$Task.run()V+67
j  org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run()V+33
j  java.lang.Thread.run()V+13 java.base@19.0.2
j  org.jboss.threads.JBossThread.run()V+12
v  ~StubRoutines::call_stub 0x000001ba5d13100e

siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), reading address 0x0000000000000000

How to Reproduce?

Steps to reproduce:

quarkus create app org.foo:reproduce-me --gradle cd reproduce-me quarkus dev

Output of uname -a or ver

Microsoft Windows [Version 10.0.22000.2057]

Output of java -version

openjdk version "19.0.2" 2023-01-17 OpenJDK Runtime Environment (build 19.0.2+7-44) OpenJDK 64-Bit Server VM (build 19.0.2+7-44, mixed mode, sharing) But happens also with 17.0.2 and others.

GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.1.2.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Gradle 8.1.1

Build time: 2023-04-21 12:31:26 UTC Revision: 1cf537a851c635c364a4214885f8b9798051175b

Kotlin: 1.8.10 Groovy: 3.0.15 Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021 JVM: 19.0.2 (Oracle Corporation 19.0.2+7-44) OS: Windows 11 10.0 amd64

Additional information

It seems to be related to the Windows CMD/Powershell environment in conjunction with Jansi 2.4.0. Initially, there was a suspicion that it could be an access rights issue on Windows, so all access protection was temporarily disabled for testing purposes. However, this did not resolve the problem. If the issue is indeed with Jansi itself, it may be necessary to report the bug to the Jansi project for further investigation and resolution.

What I find particularly peculiar is that the error does not occur when using Gradle directly via gradlew quarkusDev. In the end, aren't they both supposed to be using the same JVM and doing the same thing? Or am I mistaken in my understanding?

quarkus-bot[bot] commented 1 year ago

/cc @evanchooly (kotlin), @geoand (kotlin)

geoand commented 1 year ago

@stalep @gnodet any idea what the problem could be or what can be done to overcome it?