解决方法

Help → Edit Custom VM Options… 添加以下参数到文件尾部:

1
-Dsun.java2d.metal=false

问题描述

实际上这个问题已经出现很久了, 但是一直没有得到解决. 从错误堆栈可以看出问题在于 AMD 的 Metal 驱动. Metal 驱动是由 Apple 提供的, 随 MacOS 版本更新而更新, 而且一般不会体现在系统更新的提示中. 所以如果同时更新系统和 IDEA, 可能会觉得锅在 MacOS 上面, 等待新版更新或者回滚 IDEA.

最后在 jetbrain 问题中心找到了答案, JBR-4531

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGABRT (0x6) at pc=0x00007ff80645900e, pid=40889, tid=61707
#
# JRE version: OpenJDK Runtime Environment JBR-17.0.4+7-469.53-jcef (17.0.4+7) (build 17.0.4+7-b469.53)
# Java VM: OpenJDK 64-Bit Server VM JBR-17.0.4+7-469.53-jcef (17.0.4+7-b469.53, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-amd64)
# Problematic frame:
# C [libsystem_kernel.dylib+0x800e] __pthread_kill+0xa
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
# https://youtrack.jetbrains.com/issues/JBR
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

--------------- S U M M A R Y ------------

Command Line: -Xms128m -Xmx750m -XX:ReservedCodeCacheSize=512m -XX:+UseG1GC -XX:SoftRefLRUPolicyMSPerMB=50 -XX:CICompilerCount=2 -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -XX:+IgnoreUnrecognizedVMOptions -XX:CompileCommand=exclude,com/intellij/openapi/vfs/impl/FilePartNodeRoot,trieDescend -ea -Dsun.io.useCanonCaches=false -Dsun.java2d.metal=true -Djbr.catch.SIGABRT=true -Djdk.http.auth.tunneling.disabledSchemes="" -Djdk.attach.allowAttachSelf=true -Djdk.module.illegalAccess.silent=true -Dkotlinx.coroutines.debug=off -XX:ErrorFile=/Users/iitii/java_error_in_idea_%p.log -XX:HeapDumpPath=/Users/iitii/java_error_in_idea.hprof -Xmx4096m -Dide.no.platform.update=true -Dtoolbox.notification.token=hJl9isz3k7VuUyXPtj2VDWaNOWByb7IVHU4D5nKhmw4= -Dtoolbox.notification.portFile=/Users/iitii/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.4167.29/IntelliJ IDEA.app.vmoptions.port -Didea.plugins.path=/Users/iitii/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.4167.29/IntelliJ IDEA.app.plugins -Djb.vmOptionsFile=/Users/iitii/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.4167.29/IntelliJ IDEA.app.vmoptions --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/jdk.internal.vm=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/sun.security.ssl=ALL-UNNAMED --add-opens=java.base/sun.security.util=ALL-UNNAMED --add-opens=java.desktop/com.apple.eawt=ALL-UNNAMED --add-opens=java.desktop/com.apple.eawt.event=ALL-UNNAMED --add-opens=java.desktop/com.apple.laf=ALL-UNNAMED --add-opens=java.desktop/java.awt=ALL-UNNAMED --add-opens=java.desktop/java.awt.dnd.peer=ALL-UNNAMED --add-opens=java.desktop/java.awt.event=ALL-UNNAMED --add-opens=java.desktop/java.awt.image=ALL-UNNAMED --add-opens=java.desktop/java.awt.peer=ALL-UNNAMED --add-opens=java.desktop/javax.swing=ALL-UNNAMED --add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED --add-opens=java.desktop/sun.awt.datatransfer=ALL-UNNAMED --add-opens=java.desktop/sun.awt.image=ALL-UNNAMED --add-opens=java.desktop/sun.awt=ALL-UNNAMED --add-opens=java.desktop/sun.font=ALL-UNNAMED --add-opens=java.desktop/sun.java2d=ALL-UNNAMED --add-opens=java.desktop/sun.lwawt=ALL-UNNAMED --add-opens=java.desktop/sun.lwawt.macosx=ALL-UNNAMED --add-opens=java.desktop/sun.swing=ALL-UNNAMED --add-opens=jdk.attach/sun.tools.attach=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-opens=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED --add-opens=jdk.jdi/com.sun.tools.jdi=ALL-UNNAMED -Dsplash=true -Didea.strict.classpath=true -Didea.jre.check=true -Didea.executable=idea -Didea.home.path=/Users/iitii/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.4167.29/IntelliJ IDEA.app/Contents -Djava.system.class.loader=com.intellij.util.lang.PathClassLoader -Didea.paths.selector=IntelliJIdea2022.2 -Didea.vendor.name=JetBrains

Host: "iMac20,1" x86_64 4100 MHz, 12 cores, 32G, Darwin 21.6.0, macOS 12.5.1 (21G83)
Time: Mon Sep 19 10:40:02 2022 CST elapsed time: 151.082012 seconds (0d 0h 2m 31s)

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

Current thread (0x00007fa6f18db000): JavaThread "Java2D Queue Flusher" daemon [_thread_in_native, id=61707, stack(0x000070000c6a0000,0x000070000c7a0000)]

Stack: [0x000070000c6a0000,0x000070000c7a0000], sp=0x000070000c79f3d8, free space=1020k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libsystem_kernel.dylib+0x800e] __pthread_kill+0xa
C [libsystem_c.dylib+0x81d24] abort+0x7b
C [libsystem_c.dylib+0x810cb] err+0x0
C [AMDMTLBronzeDriver+0x199a8a] _Z28amdMtlBronzeCmdBufUpdateRsrcP19BronzeCmdBufInfoRecP18MTLIOAccelResourcejj.cold.1+0x23
C [AMDMTLBronzeDriver+0x7f3bd] _Z33amdMtlBronzeCmdBufAddIndirectRsrcP19BronzeCmdBufInfoRecP18MTLIOAccelResourcejb+0x0
C [AMDMTLBronzeDriver+0x96a78] _ZL21amdMtl_HWL_SetTextureIL15AMDMtl_SqttMode0EEvP32BronzeRenderCmdEncoderMembersRecjPU21objcproto10MTLTexture11objc_objectjj+0x4b
C [libawt_lwawt.dylib+0xa1544] MTLVertexCache_AddGlyphQuad+0x84
C [libawt_lwawt.dylib+0x9dcaf] MTLTR_DrawGlyphList+0x90f
C [libawt_lwawt.dylib+0x99150] Java_sun_java2d_metal_MTLRenderQueue_flushBuffer+0x1020
J 21692 sun.java2d.metal.MTLRenderQueue.flushBuffer(JI)V java.desktop (0 bytes) @ 0x0000000123c5d955 [0x0000000123c5d8a0+0x00000000000000b5]

Refers

  • JBR-4531