JDK-8276551 : [macos] JavaFX Application crashes with problematic frame ~StubRoutines::SafeFetchN
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: openjfx17
  • Priority: P4
  • Status: Closed
  • Resolution: Incomplete
  • OS: os_x
  • CPU: generic
  • Submitted: 2021-10-29
  • Updated: 2021-11-29
  • Resolved: 2021-11-03
Related Reports
Duplicate :  
Description
ADDITIONAL SYSTEM INFORMATION :
MacOS/ Monterey M1/ 17

A DESCRIPTION OF THE PROBLEM :
I run my Javafx project manually using VSCode on MacOS Monterey. It's complied very well, but in running the project after opening the window, it will be closed after a few seconds!
Before updating my macOS, it ran without crashing!

ERROR MESSAGES/STACK TRACES THAT OCCUR :
A fatal error has been detected by the Java Runtime Environment:
#
#  SIGBUS (0xa) at pc=0x000000010d97d4f0, pid=1848, tid=37647
#
# JRE version: Java(TM) SE Runtime Environment (17.0+35) (build 17+35-LTS-2724)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (17+35-LTS-2724, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
# Problematic frame:
# v  ~StubRoutines::SafeFetchN
#
# 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/<USER>/_workplace/university/pdp06/pdp06/src/hs_err_pid1848.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
zsh: abort      java --module-path  --add-modules javafx.controls App


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
 command to compile:
javac --module-path /Users/<USER>/_workplace/university/javafx-sdk-17.0.0.1/lib --add-modules javafx.controls,javafx.fxml,javafx.graphics App.java

command to run:
java --module-path /Users/<USER>/_workplace/university/javafx-sdk-17.0.0.1/lib --add-modules javafx.controls App

ACTUAL -
the program run but after a few seconds il will be closed

---------- BEGIN SOURCE ----------
import java.io.IOException;

import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyCode;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Border;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Screen;
import javafx.stage.Stage;

public class App extends Application {
    // Primary stage
    Stage window;

    // map displayed
    public Canvas mapCanvas;

    // size of the screen user
    public double maxHeight, maxWidth;

    public int mouseX, mouseY;
    public int tuileX, tuileY;

    @Override
    public void start(Stage primaryStage) throws Exception {
        try {
            window = primaryStage;
            window.setTitle("Projet de programmation groupe 06");

            // Root pane
            AnchorPane root = new AnchorPane();

            // root.setPadding(new Insets(5, 0, 5, 0));
            // root.setVgap(4);
            // root.setHgap(4);

            // get size of the screen
            maxHeight = Screen.getPrimary().getBounds().getHeight();
            maxWidth = Screen.getPrimary().getBounds().getWidth();

            // set canvas
            mapCanvas = new Canvas(maxHeight, maxWidth);
            mapCanvas.setId("myCanvas");
            GraphicsContext gc = mapCanvas.getGraphicsContext2D();

            // search box
            // de
            Label fromThisPlace = new Label("De:");
            TextField fromTextField = new TextField();
            // à
            Label toThisPlace = new Label("À:");
            TextField toTextField = new TextField();
            // toTextField.setStyle("-fx-float: left");
            VBox searchBar = new VBox();
            searchBar.setStyle("-fx-padding: 10;" + "-fx-background-radius: 7;"
                    + "-fx-background-color: rgba(256, 256, 256, 0.7)");
            searchBar.setMaxSize(250, 700);
            VBox.setMargin(fromTextField, new Insets(5, 0, 5, 0));
            VBox.setMargin(toTextField, new Insets(5, 0, 5, 0));
            searchBar.setPadding(new Insets(10, 10, 10, 10));
            searchBar.getChildren().addAll(fromTextField, toTextField);

            // Scene scene = new Scene(root, maxHeight, maxWidth);

            mapCanvas.setOnMousePressed(e -> {
                mouseX = (int) e.getX();
                mouseY = (int) e.getY();
            });

            OSMAPI api = new OSMAPI();
            mapCanvas.setOnMouseDragged(e -> {
                // clear
                gc.clearRect(0, 0, maxWidth, maxHeight);
                // draw
                gc.setFill(Color.BLUE);
                tuileX += (int) e.getX() - mouseX;
                tuileY += (int) e.getY() - mouseY;
                try {
                    api.drawMap(gc, tuileX, tuileY, (int) maxWidth / 2, (int) maxHeight / 2);
                } catch (IOException e1) {
                    System.out.println(e1);
                }
                mouseX = (int) e.getX();
                mouseY = (int) e.getY();
            });

            mapCanvas.setOnKeyPressed(e -> {
                if (e.getCode() == KeyCode.Z) {
                    try {
                        api.makeZoom(gc, true, (int) maxWidth, (int) maxHeight, tuileX, tuileY);
                    } catch (IOException e1) {
                        System.out.println(e1);
                    }
                } else if (e.getCode() == KeyCode.S) {
                    try {
                        api.makeZoom(gc, false, (int) maxWidth, (int) maxHeight, tuileX, tuileY);
                    } catch (IOException e1) {
                        System.out.println(e1);
                    }
                }
            });

            // Adding propertises to root pane
            root.getChildren().addAll(mapCanvas, searchBar);
            AnchorPane.setLeftAnchor(searchBar, 50.0);
            AnchorPane.setTopAnchor(searchBar, 50.0);
            // root.setCenter(mapCanvas);

            // binding property to root pane
            mapCanvas.widthProperty().bind(root.widthProperty());
            mapCanvas.heightProperty().bind(root.heightProperty());

            // Init Scene
            Scene scene = new Scene(root, maxHeight, maxWidth);
            root.getStyleClass().add("scene");

            // init middle
            tuileX = (int) ((maxWidth / 2));
            tuileY = (int) ((maxHeight / 2));

            // init the map
            api.findAdress(gc, "XXXX XXXXXXX", (int) maxWidth, (int) maxHeight);

            window.setScene(scene);
            window.show();
        } catch (Exception e) {
            Label l = new Label(e.toString());
            Scene scene = new Scene(new StackPane(l), 640, 480);
            window.setScene(scene);
            window.show();

        }
    }

    public static void main(String[] args) {
        launch();
    }

}
---------- END SOURCE ----------

FREQUENCY : always



Comments
Haven't received additional information from the submitter, closing this issue as incomplete, shall reopen if any updates received.
29-11-2021

Mail to submitter: ============= Requesting for hs_err file.
10-11-2021

This is very likely a duplicate of JDK-8275723, but we need to see the hs_err file to be sure.
05-11-2021

From the description, testcase has dependency on other libraries(OSMAPI), Requesting submitter for minimal, reproducible testcase. Mail to submitter: ============= Please share minimal, reproducible testcase/steps/ scenario to analyze the issue.
03-11-2021