plantuml / plantuml

Generate diagrams from textual description
https://plantuml.com
Other
9.73k stars 881 forks source link

Bug Report for PlantUML on macOS Sonoma 14.1.1 M2 Pro Max #1615

Open ThingUroboros opened 5 months ago

ThingUroboros commented 5 months ago

To Reproduce Steps to reproduce the behavior:

Launch the application on Mac OS Sonoma 14.1.1 on a MacBook Pro. Execute the command plantUML x.puml. During the application's execution, the above-mentioned warning appears. Subsequently, the application crashes with a SIGILL error and the provided message. This updated section outlines the specific command that triggers the issue within the application.

% plantUML x.puml
2023-11-29 15:09:00.588 java[12357:453300] WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:.
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGILL (0x4) at pc=0x000000010514efc8, pid=12357, tid=1815
#
# JRE version: OpenJDK Runtime Environment Homebrew (21.0.1) (build 21.0.1)
# Java VM: OpenJDK 64-Bit Server VM Homebrew (21.0.1, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
# Problematic frame:
# C  [libawt.dylib+0x2efc8]  fillAAPgram+0x3e0
#
# 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:
# /Users/martinburianek/hs_err_pid12357.log
#
# If you would like to submit a bug report, please visit:
#   https://github.com/Homebrew/homebrew-core/issues
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

hs_err_pid12357.log

liningpan commented 5 months ago

I'm running into the same issue. Not sure if this is related to the homebrew issue https://github.com/Homebrew/homebrew-core/issues/150824

arnaudroques commented 5 months ago

For the record, we do not use JNI. So I am not sure what we can do about this... Sorry about that!

liningpan commented 5 months ago

Sorry @arnaudroques. I saw the illegal instruction and assumed that it's some JNI issue. However, after a little bit of investigation, it seem like the problem is in the Apple SDK homebrew is using to compile JDK. It's also affecting other Java applications.

arnaudroques commented 5 months ago

Do you think it might be related to Swing? There is light Swing Windows integrated in PlantUML and if needed, we could build a temporary version without this Swing Window, just for Mac. Would that help?

liningpan commented 5 months ago

Thanks! I'm not familiar with java GUI libraries. I don't think the problem is in the Swing window. Given this call stack, I assume that the error actually happened during the process of rendering images and unrelated to the Swing window. If you think it might be related to Swing, and it is easy to build on your end, I'm happy to test.

In addition, I tested a different JDK (Amazon Corretto 21) and managed to get plantuml run properly.

C  [libawt.dylib+0x2efc8]  fillAAPgram+0x3e0
C  [libawt.dylib+0x2e7a8]  Java_sun_java2d_loops_MaskFill_FillAAPgram+0x320
j  sun.java2d.loops.MaskFill.FillAAPgram(Lsun/java2d/SunGraphics2D;Lsun/java2d/SurfaceData;Ljava/awt/Composite;DDDDDD)V+0 java.desktop@21.0.1
j  sun.java2d.pipe.AlphaColorPipe.fillParallelogram(Lsun/java2d/SunGraphics2D;DDDDDDDDDD)V+25 java.desktop@21.0.1
j  sun.java2d.pipe.PixelToParallelogramConverter.drawGeneralLine(Lsun/java2d/SunGraphics2D;DDDD)Z+634 java.desktop@21.0.1
j  sun.java2d.pipe.PixelToParallelogramConverter.drawLine(Lsun/java2d/SunGraphics2D;IIII)V+12 java.desktop@21.0.1
j  sun.java2d.SunGraphics2D.drawLine(IIII)V+10 java.desktop@21.0.1
j  net.sourceforge.plantuml.klimt.drawing.g2d.DriverTextG2d.printSingleText(Ljava/awt/Graphics2D;Lnet/sourceforge/plantuml/klimt/font/FontConfiguration;Ljava/lang/String;DDLnet/sourceforge/plantuml/klimt/color/ColorMapper;)D+399
j  net.sourceforge.plantuml.klimt.drawing.g2d.DriverTextG2d.draw(Lnet/sourceforge/plantuml/klimt/shape/UText;DDLnet/sourceforge/plantuml/klimt/color/ColorMapper;Lnet/sourceforge/plantuml/klimt/UParam;Ljava/awt/Graphics2D;)V+101
j  net.sourceforge.plantuml.klimt.drawing.g2d.DriverTextG2d.draw(Lnet/sourceforge/plantuml/klimt/UShape;DDLnet/sourceforge/plantuml/klimt/color/ColorMapper;Lnet/sourceforge/plantuml/klimt/UParam;Ljava/lang/Object;)V+17
j  net.sourceforge.plantuml.klimt.drawing.AbstractUGraphic.draw(Lnet/sourceforge/plantuml/klimt/UShape;)V+157
j  net.sourceforge.plantuml.klimt.shape.TileText.drawU(Lnet/sourceforge/plantuml/klimt/drawing/UGraphic;)V+189
j  net.sourceforge.plantuml.klimt.shape.SingleLine.drawU(Lnet/sourceforge/plantuml/klimt/drawing/UGraphic;)V+84
j  net.sourceforge.plantuml.klimt.shape.TextBlockRaw.drawU(Lnet/sourceforge/plantuml/klimt/drawing/UGraphic;)V+53
j  net.sourceforge.plantuml.klimt.shape.TextBlockVertical2.drawU(Lnet/sourceforge/plantuml/klimt/drawing/UGraphic;)V+151
j  net.sourceforge.plantuml.klimt.shape.TextBlockVertical2.drawU(Lnet/sourceforge/plantuml/klimt/drawing/UGraphic;)V+151
j  net.sourceforge.plantuml.klimt.shape.TextBlockVertical2.drawU(Lnet/sourceforge/plantuml/klimt/drawing/UGraphic;)V+151
j  net.sourceforge.plantuml.klimt.shape.TextBlockMarged.drawU(Lnet/sourceforge/plantuml/klimt/drawing/UGraphic;)V+57
j  net.sourceforge.plantuml.klimt.shape.TextBlockUtils$3.drawU(Lnet/sourceforge/plantuml/klimt/drawing/UGraphic;)V+5
j  net.atmp.ImageBuilder.writeImageInternal(Ljava/io/OutputStream;Lnet/sourceforge/plantuml/anim/Animation;)Lnet/sourceforge/plantuml/core/ImageData;+227
j  net.atmp.ImageBuilder.write(Ljava/io/OutputStream;)Lnet/sourceforge/plantuml/core/ImageData;+150
j  net.sourceforge.plantuml.PlainDiagram.exportDiagramNow(Ljava/io/OutputStream;ILnet/sourceforge/plantuml/FileFormatOption;)Lnet/sourceforge/plantuml/core/ImageData;+18
j  net.sourceforge.plantuml.error.PSystemError.exportDiagramNow(Ljava/io/OutputStream;ILnet/sourceforge/plantuml/FileFormatOption;)Lnet/sourceforge/plantuml/core/ImageData;+74
j  net.sourceforge.plantuml.AbstractPSystem.exportDiagram(Ljava/io/OutputStream;ILnet/sourceforge/plantuml/FileFormatOption;)Lnet/sourceforge/plantuml/core/ImageData;+9
j  net.sourceforge.plantuml.PSystemUtils.exportDiagramsDefault(Lnet/sourceforge/plantuml/core/Diagram;Lnet/sourceforge/plantuml/file/SuggestedFile;Lnet/sourceforge/plantuml/FileFormatOption;)Ljava/util/List;+63
j  net.sourceforge.plantuml.PSystemUtils.exportDiagrams(Lnet/sourceforge/plantuml/core/Diagram;Lnet/sourceforge/plantuml/file/SuggestedFile;Lnet/sourceforge/plantuml/FileFormatOption;Z)Ljava/util/List;+166
j  net.sourceforge.plantuml.SourceFileReaderAbstract.getGeneratedImages()Ljava/util/List;+236
j  net.sourceforge.plantuml.Run.manageFileInternal(Ljava/io/File;Lnet/sourceforge/plantuml/Option;Lnet/sourceforge/plantuml/ErrorStatus;)V+329
j  net.sourceforge.plantuml.Run.processArgs(Lnet/sourceforge/plantuml/Option;Lnet/sourceforge/plantuml/ErrorStatus;)V+211
j  net.sourceforge.plantuml.Run.manageAllFiles(Lnet/sourceforge/plantuml/Option;Lnet/sourceforge/plantuml/ErrorStatus;)V+56
j  net.sourceforge.plantuml.Run.main([Ljava/lang/String;)V+624
c835722 commented 5 months ago

Is there a known workaround?

liningpan commented 5 months ago

You can use a different JDK (I tried Amazon Corretto 21, because they are building against a different apple SDK). An alternative approach is to run the plantuml server locally in docker https://github.com/plantuml/plantuml-server#how-to-run-the-server-with-docker.

c835722 commented 5 months ago

This works for me

docker run --rm -v .:/source -v .:/target plantuml/plantuml -tpng '/source/*.puml' 
mbucc commented 1 month ago

The OpenJDK Bug was fixed in November 2023 by commit 940f67c1.

This fix is not in Homebrew (openjdk version "21.0.2" 2024-01-16) as of today. :(