Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8242361

JavaFX Web View crashes with Segmentation Fault, when HTML contains Data-URIs

    XMLWordPrintable

    Details

    • Subcomponent:
      web
    • CPU:
      x86_64
    • OS:
      windows_10

      Backports

        Description

        ADDITIONAL SYSTEM INFORMATION :
        Java 11.0.6
        OpenJFX 11.0.2 (reproducible also in all higher versions up to 15-ea+2)
        Windows 10

        A DESCRIPTION OF THE PROBLEM :
        JavaFX Web View crashes in Spring Boot Fat-Jar with Segmentation Fault, when displayed HTML contains Data-URIs.

        When executing in exploded form e.g. from within an IDE like Eclipse, the application works without issue.

        REGRESSION : Last worked in version 8u241

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        - Create Spring Boot sample application with JavaFX WebView - containing a data-URI.
        - Assemble a Spring Boot Fat Jar
        - Run the application with "java -jar SampleApplication.jar" ends with "Segmentation Fault"

        Error only occurs in a fat Jar. I do not have any indication that the issue is related to Spring Boot, I just emphasize this fact, because the WebView only crashes, when it is inside a Fat-Jar. Without displaying a Data-URI in the WebView, JavaFX and Spring Boot work together like a charm.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        - WebView displays Data-URIs (e.g. <img src ="data:image/gif;base64,R0lGODdhEAAQAMwAAPj7+FmhUYjNfGuxYYDJdYTIeanOpT+DOTuANXi/bGOrWj6CONzv2sPjv2CmV1unU4zPgISg6DJnJ3ImTh8Mtbs00aNP1CZSGy0YqLEn47RgXW8amasW7XWsmmvX2iuXiwAAAAAEAAQAAAFVyAgjmRpnihqGCkpDQPbGkNUOFk6DZqgHCNGg2T4QAQBoIiRSAwBE4VA4FACKgkB5NGReASFZEmxsQ0whPDi9BiACYQAInXhwOUtgCUQoORFCGt/g4QAIQA7"/>)
        ACTUAL -
        - JVM crashes with Segmentation fault. No error code delivered.

        ---------- BEGIN SOURCE ----------
        SampleApplication:
        package com.sampleapp;

        import org.springframework.boot.autoconfigure.SpringBootApplication;

        import javafx.application.Application;
        import javafx.scene.Scene;
        import javafx.scene.web.WebView;
        import javafx.stage.Stage;

        /**
         * Main Spring-Boot class with JavaFX launcher.
         *
         * @author MartinKoster
         *
         */
        @SpringBootApplication
        public class SampleApplication {

            public static void main(final String[] args) {
                Application.launch(JavaFxApplication.class, args);
            }

            public static class JavaFxApplication extends Application {

                @Override
                public void start(final Stage primaryStage) {
                    final WebView webView = new WebView();
                    webView.getEngine().loadContent(
                            "<html><body><img src=\"data:image/gif;base64,R0lGODdhEAAQAMwAAPj7+FmhUYjNfGuxYYDJdYTIeanOpT+DOTuANXi/bGOrWj6CONzv2sPjv2CmV1unU4zPgISg6DJnJ3ImTh8Mtbs00aNP1CZSGy0YqLEn47RgXW8amasW7XWsmmvX2iuXiwAAAAAEAAQAAAFVyAgjmRpnihqGCkpDQPbGkNUOFk6DZqgHCNGg2T4QAQBoIiRSAwBE4VA4FACKgkB5NGReASFZEmxsQ0whPDi9BiACYQAInXhwOUtgCUQoORFCGt/g4QAIQA7\"/></body></html>");
                    final Scene scene = new Scene(webView, 100, 100);
                    primaryStage.setScene(scene);
                    primaryStage.show();
                }
            }
        }

        build.gradle:

        plugins {
            id 'org.springframework.boot' version "2.2.5.RELEASE"
            id 'io.spring.dependency-management' version '1.0.9.RELEASE'
            id 'java'
            id 'maven-publish'
        }

         
            apply plugin: 'java'
            apply plugin: 'org.springframework.boot'
            apply plugin: 'io.spring.dependency-management'

            sourceCompatibility = "11"
            targetCompatibility = "11"

        bootJar {
                 enabled = true
        mainClassName = 'com.sampleapp.SampleApplication'
        }
              
            repositories {
                mavenLocal()
        jcenter()
            }
            

        [compileJava, compileTestJava,]*.options*.encoding = 'UTF-8'
            

            dependencies {

                // JAVAFX CROSS PLATFORM DEPENDENCIES
          implementation "org.openjfx:javafx-base:11.0.2:win"
        implementation "org.openjfx:javafx-controls:11.0.2:win"
        implementation "org.openjfx:javafx-fxml:11.0.2:win"
        implementation "org.openjfx:javafx-graphics:11.0.2:win"
        implementation "org.openjfx:javafx-media:11.0.2:win"
        implementation "org.openjfx:javafx-web:11.0.2:win"
        implementation "org.openjfx:javafx-swing:11.0.2:win"

        implementation "org.openjfx:javafx-base:11.0.2:linux"
        implementation "org.openjfx:javafx-controls:11.0.2:linux"
        implementation "org.openjfx:javafx-fxml:11.0.2:linux"
        implementation "org.openjfx:javafx-graphics:11.0.2:linux"
        implementation "org.openjfx:javafx-media:11.0.2:linux"
        implementation "org.openjfx:javafx-web:11.0.2:linux"
        implementation "org.openjfx:javafx-swing:11.0.2:linux"
                   

                // SPRING BOOT
                implementation("org.springframework.boot:spring-boot-starter-web")
            
            }



        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        Use application in exploded form.

        FREQUENCY : always


          Attachments

            Issue Links

              Activity

                People

                Assignee:
                kcr Kevin Rushforth
                Reporter:
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: