-
Notifications
You must be signed in to change notification settings - Fork 145
WebView crashes with some websites #316
Comments
@dukescript I tested with latest code in windows 7 and i could not reproduce the crash for both sites http://html5test.com/, https://openjfx.io/. |
I'm running Windows 10, and I can reproduce it every time. Can I provide any more information to help reproducing it? |
On a mac I get this:
|
I can reproduce the issue on Mac (High Sierra), running the Maven project, even with JavaFX 11.0.1 and OpenJDK 11.0.1:
However, it works fine if I run from command line ( |
Thanks @jperedadnr for testing and for the workaround. |
After feedback here I checked why only Maven failed: I started from NetBeans, which by default uses "exec:java". After changing this to "exec:exec" it works fine. |
I'm running into this issue on my Macs (one High Sierra and one Mojave). I'm testing in my own project (not the basic HelloFX) but the supposed fix with changing exec:java to exec:java does not work (or even make sense). I can load https://www.google.com just fine, but any github URL causes WebView to crash. |
Please file a new bug with enough information to reproduce it. At least we need a test case along with your system info. If you can provide the hs_err*.log file that would be helpful. I am closing this bug, since the original problem was resolved, and was not a JavaFX problem. |
I just tried the exact same setup as @dukescript and got the exact same error, except NetBeans wasn't used at all. I just compiled via "mvn compile exec:java" and the program segfaults. Here's the message I get:
I don't think this warrants a separate issue because it is exactly the same problem as the original and the proposed fix (changing something in netbeans) doesn't apply here. I'm fine creating a separate one if you want though. |
To be clear: I just tried the hellofx example from the openjfx/samples repository, but with the HelloFX class modified to match that of the original post. |
OK, I'll reopen it then. |
This has all the hallmarks of a mismatch between the native jfxwebkit.so file and the Java class files. Can you run it with |
I get this additional output when I run with the
|
That will load
You might check the time stamp on that file and see if it is up to date. Other than that, I can't think of anything obvious. |
I can reproduce this error on Debian Buster |
Am I correct that this only occurs when you are using mvn and exec:java ? |
@johanvos That is correct. I was able to get it to work without crashing when starting via the java command instead of using mvn exec:java. I ran it both ways (mvn and straight java command) with the javafx.verbose=true. Looks like mvn is looking for dylib files in the m2 repository but that only contains jar files (which themselves contain the dylib files). It then falls back to using the cache referred to by @kevinrushforth. Java just uses the dylibs in the lib directory in the openjfx sdk. |
This seems to load libjfxwebkit.so from this location: Any idea on how it got there? |
The order of searching is a bit more complex, and described in https://github.com/javafxports/openjdk-jfx/blob/develop/modules/javafx.graphics/src/main/java/com/sun/glass/utils/NativeLibLoader.java First, loadLibraryFullPath is called. If that doesn't retrieve the library, the java.library.path is searched. If that fails, the resources are checked, and the library will be cached. |
I can now reproduce this on linux. In this case, the webkit library is loaded from the resources, but it is exactly the same as the version in the javafx sdk. Also, using gradle, or using mvn with a separate Java process, there is no problem. The crash occurs here:
That can be due to sending null as one of the parameters to callStaticBooleanMethod The function calling this is:
(where GetFileSystemClass should return com.sun.webkit.FileSystem) |
I've traced it down to This is code that is called in
the FileSystemClass is obtained as follows:
When running an application the way it should be (e.g. java -p /path/to/modules --add-modules javafx.web...) this works fine, the FileSystem class is obtained and the method is obtained, e.g. [JVDBG] makeAllDirectories, native, mid = 0x7f2cc8524db0 When running from the maven launcher command (
Clearly, this leads to a crash in the VM when invoking that (nil) method. Hence, when using the maven java launcher, the code in webkit can not access com.sun.webkit.FileSystem Using the maven java launcher fails. That is not a bug in JavaFX. We can make the error more elegant, by checking on the FileSystem class being null, and if so throwing a Java Exception (instead of a VM crash). But there are many places where this happens, and we should be careful not to decrease performance. |
This cache folder and how it is handled causes other issues as well, with compatibility with maven. Not sure if it is related to the library loading issues here, but I think it really should be rethought. I didn't look closely, but also didn't notice any handling for multiple JVMs trying to run JavaFX apps at the same time - and the file collisions that could happen in creating or locking that cache location on different platforms. https://mail.openjdk.java.net/pipermail/openjfx-dev/2019-January/023010.html This will also cause problems with tomcat style containers, which use classloader isolation - we can now no longer start JavaFX in headless mode to use the tasks APIs, etc, without doing hackery like I have below. To me, each JVM that tries to start a JavaFX instance should be writing to its own folder in tmp, not in an arbitrary cache folder. I've currently been using this hack, to make each maven plugin that tries to start a JavaFX process use its own file path:
Fragile as that is... This was not a problem we had in JDK 8. It is one of many stumbles I've had trying to migrate to JDK 11. |
That is already possible, by setting the By default, we don't do that as in most cases you don't want to reinstall the libraries all the time. But with that property, you have full control over where the native libraries are cached. |
There was some mention of using mvn exec:exec to run the program without the crashing issue discussed here. Could someone elaborate more on how that would work for the hellofx example? |
See issue openjfx/openjfx-docs#76, basically you will need to add the same |
Yes webview crashes |
I get the same thing running on Mac OS 10.14.5, Open JDK 11 Here is the crash report I'm using a custom classloader that tries to detect JavaFX, and if not present, it loads it from a predefined folder. I do this so that the app works on both JDKs that included JavaFX, and ones that do not. |
The crash is due to a mismatch between the Java modules and the native libraries, which are getting pulled from the wrong location. Since this is a configuration / setup issue, I am closing this. |
This is not the issue (at least in my case) and I think this should be re-opened. I am using update4j to load JavaFX dynamically in the modulepath using the maven-built JavaFX jars. Even if I use the Gluon JavaFX SDK, which has the native libs separated from the javafx jars, I get exactly the same crash ("jni_CallStaticBooleanMethodV+0x84"), even though the native libs are clearly loaded from the correct locations (verified by the output of -Djavafx.verbose). EDIT:
Since this is not a JavaFX bug, can you please point out were the bug originates from? |
Update Ok, I saw you created update4j/update4j#83 I'm facing the same problem as @nemphys (were you able to solve it?). I don't get an
But as explained by @johanvos, that's not an issue (you get the same messages when starting it successfully without update4j) @nemphys I'm highly suspect it has something to do with class/module loaders since that seems to be the only difference. |
WebView crashes with JDK 11.0.1 on Windows and OS X in a Maven project when trying to load http://html5test.com/ or https://openjfx.io/. (Works fine for loading https://google.com)
Observed behaviour:
The website loads and I can see the content building up for 1 or 2 seconds. Then the application crashes
How ro reproduce:
try to load http://html5test.com/ or https://openjfx.io/
I attached a maven project with the test code.
java11-webview-crash.zip
The text was updated successfully, but these errors were encountered: