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

[WebView] JVM crash due to memory leak in WebView/Webkit

    Details

    • Subcomponent:
      web

      Description

      Note, this description was already given by my colleague Nicolai Kilian to RT-30354, which seems to describe the same issue but was put to resolved even though the issue can still be reproduced both on Java 1.7.0_45 as well as Java 8 build 120 (see Dierk König's comment on RT-30354). As commenting didn't help we create a new issue.

      For us this issue is not just critical but actually a blocker (!) as the WebView is needed for the core functionality of our customer project!



      We're experiencing crashes in JavaFX web browser when using Google Maps.
      It can be reproduced using this little project:

      http://uploadir.com/uploads/9uitfqvw/downloads/new

      From the README:

      Application to test memory consumption behavior of Google Maps inside the embedded webkit browser of JavaFX.
      It demonstrates that under Java 1.7.0_45, there is a memory leak related to JavaFX when using Google Maps with a lot of objects,
      in contrast to loading the same HTML in Google Chrome.

      ** Test scenario **
      When mapViewer.html is loaded, the Browser first navigates to Google Maps.
      Then, in Javascript, 10'000 markers in and around Switzerland are created and displayed in Google Maps.
      Finally, zooming in and out in the area of Switzerland is performed 40 times.

      ** Test environments **
      All tests were performed under Windows 7 so far.
      If mapViewer.html is opened in Google Chrome version 31.0.1650.63 m, the process memory consumption remains well below 300 MB.
      However, if it is opened in the JavaFX application, Java 1.7.0_45, the process memory consumption increases from 200 MB to about 1500 MB.
      At this point, the application crashes under Java 32 bit, but the memory leak is equally visible under Java 64 bit.

      ** How to reproduce **
      - Install Java 1.7.0_45, JRE 32bit. http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
      - Install Maven 3. http://maven.apache.org/download.cgi
      - Edit googlemapsloader.js, edit the variable "var gMapsKey=". Insert your Google Maps API key into the quotes. How to get a key:
        https://developers.google.com/maps/documentation/javascript/tutorial?hl=fr#api_key
      - Open mapViewer.html in Google Chrome and watch the working memory consumption, e.g. using Process Explorer under Windows.
      - In the command line, navigate to the projects main directory and enter
        mvn clean jfx:jar <Return>
      - Then, in Windows explorer, navigate to JFXMemoryTest\target\jfx\app and double-click JFXMemoryTests-1.0-SNAPSHOT-jfx.jar.
        Watch the growing working memory consumption, e.g. using Process Explorer under Windows.

        Issue Links

          Activity

          Hide
          duke J. Duke (Inactive) added a comment - - edited
          In JDK8 webview/webkit has a memory leak when zooming in and out of Google Maps. Can you check if this is fixed in JDK9? Thanks.
          Show
          duke J. Duke (Inactive) added a comment - - edited In JDK8 webview/webkit has a memory leak when zooming in and out of Google Maps. Can you check if this is fixed in JDK9? Thanks.
          Hide
          duke J. Duke (Inactive) added a comment -
          @kevin Well browsing Google Maps with JDK 9 x86 (build 1.9.0-ea-b53 ) on Windows 7 64bit, crashes jfxwebkit.dll after a while still, just tested it out now.

          # Problematic frame:
          # C [jfxwebkit.dll+0x7e57ff]
          Current thread (0x47c31800): JavaThread "JavaFX Application Thread" [_thread_in_native, id=5652, stack(0x4e310000,0x4e410000)]
          ...
          Stack: [0x4e310000,0x4e410000], sp=0x4e40dc84, free space=1015k
          Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
          C [jfxwebkit.dll+0x7e57ff]
          ...
          Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
          J 4839 com.sun.webkit.WebPage.twkProcessMouseEvent(JIIIIIIIZZZZZF)Z (0 bytes) @ 0x028501f4 [0x02850150+0xa4]
          J 4838 C1 com.sun.webkit.WebPage.dispatchMouseEvent(Lcom/sun/webkit/event/WCMouseEvent;)Z (166 bytes) @ 0x02c129e0 [0x02c124c0+0x520]
          J 4864 C1 javafx.scene.web.WebView.processMouseEvent(Ljavafx/scene/input/MouseEvent;)V (184 bytes) @ 0x02af03e4 [0x02af0020+0x3c4]
          ...
          Show
          duke J. Duke (Inactive) added a comment - @kevin Well browsing Google Maps with JDK 9 x86 (build 1.9.0-ea-b53 ) on Windows 7 64bit, crashes jfxwebkit.dll after a while still, just tested it out now. # Problematic frame: # C [jfxwebkit.dll+0x7e57ff] Current thread (0x47c31800): JavaThread "JavaFX Application Thread" [_thread_in_native, id=5652, stack(0x4e310000,0x4e410000)] ... Stack: [0x4e310000,0x4e410000], sp=0x4e40dc84, free space=1015k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [jfxwebkit.dll+0x7e57ff] ... Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) J 4839 com.sun.webkit.WebPage.twkProcessMouseEvent(JIIIIIIIZZZZZF)Z (0 bytes) @ 0x028501f4 [0x02850150+0xa4] J 4838 C1 com.sun.webkit.WebPage.dispatchMouseEvent(Lcom/sun/webkit/event/WCMouseEvent;)Z (166 bytes) @ 0x02c129e0 [0x02c124c0+0x520] J 4864 C1 javafx.scene.web.WebView.processMouseEvent(Ljavafx/scene/input/MouseEvent;)V (184 bytes) @ 0x02af03e4 [0x02af0020+0x3c4] ...
          Hide
          kcr Kevin Rushforth added a comment -
          It seems that this issue is not resolved by the new WebKit so we will need to evaluate it further.
          Show
          kcr Kevin Rushforth added a comment - It seems that this issue is not resolved by the new WebKit so we will need to evaluate it further.
          Hide
          anashaty Anton Nashatyrev (Inactive) added a comment -
          I seems that this issue was partially resolved:
          JDK 8u40b13 quite quickly eat the memory with this demo, i.e. grown up to ~6Gb in 10-20sec
          JDK 8u60b12 is growing its working set mem ~100M per minute
          Show
          anashaty Anton Nashatyrev (Inactive) added a comment - I seems that this issue was partially resolved: JDK 8u40b13 quite quickly eat the memory with this demo, i.e. grown up to ~6Gb in 10-20sec JDK 8u60b12 is growing its working set mem ~100M per minute
          Hide
          anashaty Anton Nashatyrev (Inactive) added a comment -
          The Webkit is leaking when using google maps only without any markers: just zooming in/out. Loading another page didn't release the memory.
          Show
          anashaty Anton Nashatyrev (Inactive) added a comment - The Webkit is leaking when using google maps only without any markers: just zooming in/out. Loading another page didn't release the memory.

            People

            • Assignee:
              anashaty Anton Nashatyrev (Inactive)
              Reporter:
              duke J. Duke (Inactive)
            • Votes:
              10 Vote for this issue
              Watchers:
              18 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: