<AWT Dev> Review Request for 8039081: [TEST_BUG] Test java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java fails

Ambarish Rapte ambarish.rapte at oracle.com
Mon Aug 1 07:24:50 UTC 2016


Hi,

      This is an older issue fix which was paused.
      Here is an updated webrev:
      http://cr.openjdk.java.net/~arapte/8039081/webrev.02/


      Issue & Fix:
        There were platforms wise different issues:

        Linux:
          Issue:
            Reference to TrayIcon was not released from member fields of XTrayIconPeer like, TrayIconCanvas, XTrayIconEmbeddedFrame.
            PopupMenu.removeNotify() was not called for PopupMenu added to TrayIcon.
            This prevented from TrayIcon & PopupMenu to TrayIcon from getting garbage collected.
            However the behavior was not uniform: Sometimes the reference gets collected but sometimes it does not even after 100+ OOMs.
          Fix:
            Released reference to TrayIcon by setting these variables to NULL.
            With this change, reference gets collected mostly with the first OOM.
            Removed listeners to avoid any events while the TrayIcon/Peer is getting disposed: Had observed a NPE at TrayIconEventProxy::MouseExited(), hence removeListeners() is required.

        Mac:
          Issue:
            The test failed with OOM exception, due to incorrect way of causing OOM in the test. (Line No.85 in existing Test)
          Fix:
            Correction in Test: Corrected the OOM causing code in test.

        Windows:
          Issue:
            The test fails to run on windows, as the popup should have a container parent.
          Fix:
            Correction in Test:
            The test is not required for windows.
            TrayIcon & PopupMenu get collected easily on windows, verified that by changes in test.
            Hence discarding execution of test on windows.



      Verification:
        No other test of TrayIcon fails due to this change on Win, Mac, Linux.



Regards,
Ambarish


-----Original Message-----
From: Sergey Bylokhov 
Sent: Monday, December 07, 2015 6:03 PM
To: Ambarish Rapte; Semyon Sadetsky; Prasanta Sadhukhan; awt-dev at openjdk.java.net
Subject: Re: <AWT Dev> Review Request for 8039081: [TEST_BUG] Test java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java fails

Hi, Ambarish.

It seems this version of the test completes successfully, before related fix was integrated(JDK-8007220) but it should fail(I tested jdk8u05b13), please double check.

On 03.12.15 11:45, Ambarish Rapte wrote:
> Hi Semyon,
>
>                  I had verified the patch fix with
>
> Windows      7   64-bit,
>
> Ubuntu 14.04  32 & 64 bit &
>
> Mac platform.
>
> Where the test executes & passes.
>
> Are you using Ubuntu 15.10 ?
>
> I am setting up Ubuntu 15.10  64 bit to reproduce the same failure.
>
> However, solution to this failure would require a small wait for gc to 
> finish.
>
> Regards,
>
> Ambarish
>
> *From:*Semyon Sadetsky
> *Sent:* Wednesday, December 02, 2015 1:54 PM
> *To:* Ambarish Rapte; Prasanta Sadhukhan; awt-dev at openjdk.java.net
> *Subject:* Re: Review Request for 8039081: [TEST_BUG] Test 
> java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java fails
>
> Hi Ambarish,
>
> Now it fails on Linux:
>
> ACTION: main -- Failed. Execution failed: `main' threw exception:
> java.lang.OutOfMemoryError: Java heap space
> REASON: User specified action: run main/othervm -Xmx50m PopupMenuLeakTest
> TIME:   1.445 seconds
> messages:
> command: main -Xmx50m PopupMenuLeakTest
> reason: User specified action: run main/othervm -Xmx50m 
> PopupMenuLeakTest elapsed time (seconds): 1.445
> STDOUT:
> STDERR:
> java.lang.OutOfMemoryError: Java heap space
>      at PopupMenuLeakTest.assertCollected(PopupMenuLeakTest.java:85)
>      at PopupMenuLeakTest.main(PopupMenuLeakTest.java:57)
>      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>      at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>      at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>      at java.lang.reflect.Method.invoke(Method.java:520)
>      at
> com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:92)
>      at java.lang.Thread.run(Thread.java:747)
>
> JavaTest Message: Test threw exception: java.lang.OutOfMemoryError: 
> Java heap space JavaTest Message: shutting down test
>
> STATUS:Failed.`main' threw exception: java.lang.OutOfMemoryError: Java 
> heap space
>
> --Semyon
>
> On 11/30/2015 6:44 PM, Ambarish Rapte wrote:
>
>     Hi Semyon,
>
>                      I have updated the fix patch with below changes,
>
>     1.Code formatting.
>
>     2.Reduced the number of OOMs.
>
>     3.Removed un-required delays.
>
>                      Please review the update patch, which causes OOM
>     early than previous change.
>
>     http://cr.openjdk.java.net/~arapte/8039081/webrev.01/
>     <http://cr.openjdk.java.net/%7Earapte/8039081/webrev.01/>
>
>     Thanks,
>     Ambarish
>
>     *From:*Semyon Sadetsky
>     *Sent:* Monday, November 30, 2015 1:54 PM
>     *To:* Ambarish Rapte; Prasanta Sadhukhan; awt-dev at openjdk.java.net
>     <mailto:awt-dev at openjdk.java.net>
>     *Subject:* Re: Review Request for 8039081: [TEST_BUG] Test
>     java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java fails
>
>     Hi Ambarish,
>
>     On my Windows 7 64bit the test fails because of timeout.
>
>     --Semyon
>
>     On 11/20/2015 1:30 PM, Ambarish Rapte wrote:
>
>         Hi All,
>
>                          Please review the fix for JDK9,
>
>                          Bug:
>         https://bugs.openjdk.java.net/browse/JDK-8039081
>
>                          Webrev:
>         http://cr.openjdk.java.net/~arapte/8039081/webrev.00/
>
>         *Issue*:
>
>         èThe test fails on windows with below exception,
>
>         Caused by: java.lang.IllegalArgumentException: illegal popup
>         menu container class
>                  at
>         sun.awt.windows.WPopupMenuPeer.<init>(WPopupMenuPeer.java:65)
>                  at
>         sun.awt.windows.WToolkit.createPopupMenu(WToolkit.java:461)
>                  at java.awt.PopupMenu.addNotify(PopupMenu.java:124)
>                  at
>         PopupMenuLeakTest.addNotifyPopup(PopupMenuLeakTest.java:63)
>
>         èWith below exception on mac, ubuntu,
>
>         java.lang.OutOfMemoryError: Java heap space
>
>                          at
>         PopupMenuLeakTest.assertCollected(PopupMenuLeakTest.java:85)
>
>                          at
>         PopupMenuLeakTest.main(PopupMenuLeakTest.java:57)
>
>                          at
>         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
>                          at
>         
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
> ava:62)
>
>                          at
>         
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> orImpl.java:43)
>
>                          at 
> java.lang.reflect.Method.invoke(Method.java:520)
>
>                          at
>         
> com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.
> java:92)
>
>                          at java.lang.Thread.run(Thread.java:747)
>
>         *Cause*:
>
>                          This is a test code issue.
>
>                          On Windows Popup menu should have a valid
>         parent container.
>
>                          Is there is no parent container , then above
>         exception is thrown.
>
>                          And also, after throwing OOM exception, program
>         tried to allocate new memory in catch.
>
>                          Which results in failure again.
>
>         *Fix*:
>
>                          Updated the test code to add popup menu as a
>         child of Frame.
>
>                          Verifiew on : Ubuntu, Windows & Mac
>
>         Many Thanks,
>
>         Ambarish
>


--
Best regards, Sergey.


More information about the awt-dev mailing list