JDK-8242361 : JavaFX Web View crashes with Segmentation Fault, when HTML contains Data-URIs
  • Type: Bug
  • Component: javafx
  • Sub-Component: web
  • Affected Version: openjfx11
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2020-04-07
  • Updated: 2021-04-28
  • Resolved: 2020-12-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 Other
8u291Fixed openjfx11.0.11Fixed
Related Reports
Relates :  
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



Comments
Changeset: e61b9239 Author: Matthias Bl��sing <mblaesing@doppel-helix.eu> Committer: Kevin Rushforth <kcr@openjdk.org> Date: 2020-12-17 18:13:01 +0000 URL: https://git.openjdk.java.net/jfx/commit/e61b9239
17-12-2020

This is reproducible using the test app attached to the PR. This isn't a problem with using a fat jar, but with an implicit assumption that the `com.sun.webkit.MainThread` class can be found using the JNI function `FindClass`.
14-12-2020

I just tried it with a recent build of JavaFX 15-ea and it runs fine for me as a local test program, which matches the findings of the bug reporter. This is not a regression versus 8u241, since it is a failure only in a new mode of operation, so I'm removing the "regression" keyword. We don't support or recommend running JavaFX from a fat jar. Having said that, I haven't heard of any similar problems with it. A possible cause might be a mismatch between the modular jar files and the DLLs. Another possible problem is a bug in the code that unpacks the fat jar.
08-04-2020