RFR: 8264990: WebEngine crashes with segfault when not loaded through system classloader [v3]
Matthias Bläsing
github.com+2179736+matthiasblaesing at openjdk.java.net
Thu Apr 15 16:43:08 UTC 2021
> The functions from FileSystemJava are called from different threads the
> root problem manifests because the JNI FindClass function behaves
> differently when called from a context that is the ancestor of a java
> frame compared to when called in isolation.
>
> A segmentation fault is observed when local storage of a webview is
> accessed. At that time a new native thread is spun up and that sets up
> the local storage, by calling into the JVM via
> WTF::FileSystem::makeAllDirectories. At that point GetFileSystemClass is
> invoked to get a referenc to the java implementation of the FileSystem.
> As this is is called from a new native thread (no java context
> available), JNI uses the system classloader to locate the class. This
> fails if the JavaFX modules are not on the boot module/class path.
>
> Instead on relying on fetching the class reference everytime it is
> needed, this change fetches it once when the JavaFX library is loaded
> and stores it in the WTF namespace.
>
> In addition to this it was observed, that there is no attachment to the
> JVM done when calling into the filesystem. No fault was observed, but
> the JNI specs indicate, that the JNIEnv interface is only valid when
> attached.
Matthias Bläsing has updated the pull request incrementally with one additional commit since the last revision:
Review fix: Use correct bug id
-------------
Changes:
- all: https://git.openjdk.java.net/jfx/pull/458/files
- new: https://git.openjdk.java.net/jfx/pull/458/files/c9ec47c9..e1de314d
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jfx&pr=458&range=02
- incr: https://webrevs.openjdk.java.net/?repo=jfx&pr=458&range=01-02
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.java.net/jfx/pull/458.diff
Fetch: git fetch https://git.openjdk.java.net/jfx pull/458/head:pull/458
PR: https://git.openjdk.java.net/jfx/pull/458
More information about the openjfx-dev
mailing list