[10] RFR for JDK-8170299: Debugger does not stop inside the low memory notifications code

Shafi Ahmad shafi.s.ahmad at oracle.com
Thu Sep 7 06:13:24 UTC 2017


Hi Daniel,

 

Thank you for the input. 

 

With this change I am not seeing any addition failure for all the suggested test suits. 

 

TEST 346/346 346/346 nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_proxy_custom PASS

HARNESS ENDED: Wed Sep 06 00:00:49 PDT 2017

 

TOTAL TESTS IN RUN: 346

TEST PASS: 346; 100% rate

TEST FAIL: 0; 0% rate

TEST UNDEFINED: 0; 0% rate

TEST INCOMPLETE: 0; 0% rate

TESTS NOT RUN: 0

 

TOTAL TEST IN TESTLIST: 359

 

Passed: com/sun/management/UnixOperatingSystemMXBean/GetOpenFileDescriptorCount.sh

Passed: com/sun/management/CheckSomeMXBeanImplPackage.java

Passed: com/sun/management/VMOptionOpenDataTest.java

Test results: passed: 30

Report written to /scratch/shshahma/Java/jdk10-dev-new/JTreport/html/report.html

Results written to /scratch/shshahma/Java/jdk10-dev-new/JTwork

 

Passed: java/lang/management/ThreadMXBean/ThreadUserTime.java

Test results: passed: 65

Report written to /scratch/shshahma/Java/jdk10-dev-new/JTreport/html/report.html

Results written to /scratch/shshahma/Java/jdk10-dev-new/JTwork

 

Passed: jdk/internal/agent/AgentCheckTest.java

Passed: jdk/internal/agent/AgentCMETest.java

Test results: passed: 2

Report written to /scratch/shshahma/Java/jdk10-dev-new/JTreport/html/report.html

Results written to /scratch/shshahma/Java/jdk10-dev-new/JTwor

 

Passed: sun/management/PlatformMBeanProviderConstructorCheck.java

Test results: passed: 33

Report written to /scratch/shshahma/Java/jdk10-dev-new/JTreport/html/report.html

Results written to /scratch/shshahma/Java/jdk10-dev-new/JTwork

 

Passed: javax/management/timer/StartTest.java

Test results: passed: 243; failed: 1

Report written to /scratch/shshahma/Java/jdk10-dev-new/JTreport/html/report.html

Results written to /scratch/shshahma/Java/jdk10-dev-new/JTwork

Error: Some tests failed or other problems occurred.

 

I verified the above failure and without my change it failed too.

 

jdk10-dev-new$ jtreg -v1 -jdk:./build/linux-x64/jdk/  jdk/test/javax/management/remote/nonLocalAccess/NonLocalJMXRemoteTest.java

FAILED: javax/management/remote/nonLocalAccess/NonLocalJMXRemoteTest.java

Test results: failed: 1

Report written to /scratch/shshahma/Java/jdk10-dev-new/JTreport/html/report.html

Results written to /scratch/shshahma/Java/jdk10-dev-new/JTwork

Error: Some tests failed or other problems occurred.

jdk10-dev-new$ tail ./JTwork/javax/management/remote/nonLocalAccess/NonLocalJMXRemoteTest.jtr

        -Dtest.timeout.factor=1.0 \\

        -Dtest.modules=java.management \\

        --add-modules java.management \\

        -Djmx-registry.host=jmx-registry-host \\

        -Djmx-registry.port=jmx-registry-port \\

        com.sun.javatest.regtest.agent.MainWrapper /scratch/shshahma/Java/jdk10-dev-new/JTwork/javax/management/remote/nonLocalAccess/NonLocalJMXRemoteTest.d/main.0.jta

result: Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Specify port with system property: -Djmx-registry.port=<port>

 

test result: Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Specify port with system property: -Djmx-registry.port=<port>

 

Regards,

Shafi

 

From: Daniel D. Daugherty 
Sent: Tuesday, September 05, 2017 10:36 PM
To: Shafi Ahmad <shafi.s.ahmad at oracle.com>; serviceability-dev at openjdk.java.net
Subject: Re: [10] RFR for JDK-8170299: Debugger does not stop inside the low memory notifications code

 

Sorry for the incomplete answer earlier. There are also
relevant tests in:

    jdk/test/java/lang/management
    jdk/test/com/sun/management
    jdk/test/sun/management
    jdk/test/jdk/internal/agent
    jdk/test/javax/management
    jdk/test/com/sun/jmx

You might want to just run the 'jdk_management' and 'jdk_jmx' test groups...
that should also pick up any closed side tests...

Dan

    

On 9/5/17 10:44 AM, Shafi Ahmad wrote:

Thank you Daniel. I will run and update it with the result.

Regards,

Shafi





On Tue, Sep 5, 2017 at 9:44 PM +0530, "Daniel D. Daugherty" <HYPERLINK "mailto:daniel.daugherty at oracle.com"daniel.daugherty at oracle.com> wrote:

Seems like you should also run: nsk.monitoring.testlist

Dan



On 9/4/17 4:11 AM, Shafi Ahmad wrote:

Hi,

 

Please review the fix for ‘JDK-8170299: Debugger does not stop inside the low memory notifications code’ to jdk10.

 

With the current implementation ‘debugger does not stop inside the low memory *notifications* code’ 

This is expected as the notification code is getting executed with the service thread, which is a hidden thread.

 

jdk10-dev-new$ jdb -Xmx32m MemoryWarningSystem

Initializing jdb ...

> stop at MemoryWarningSystem$1:25

Deferring breakpoint MemoryWarningSystem$1:25.

It will be set after the class is loaded.

> run

run MemoryWarningSystem

Set uncaught java.lang.Throwable

Set deferred uncaught java.lang.Throwable

> 

. . .

> quit

 

Breakpoint not hit.

 

With the attached webrev, jdb stop  at breakpoint inside notification code.

 

jdk10-dev-new$ jdb -Xmx64m MemoryWarningSystem

Initializing jdb ...

> stop at MemoryWarningSystem$1:25

Deferring breakpoint MemoryWarningSystem$1:25.

It will be set after the class is loaded.

> run

run MemoryWarningSystem

Set uncaught java.lang.Throwable

Set deferred uncaught java.lang.Throwable

> 

VM Started: Set deferred breakpoint MemoryWarningSystem$1:25

 

Breakpoint hit: "thread=Thread-0", MemoryWarningSystem$1.memoryUsageLow(), line=25 bci=0

25            System.out.println("Memory usage low!!!");

 

Thread-0[1] step

> Memory usage low!!!

 

Step completed: "thread=Thread-0", MemoryWarningSystem$1.memoryUsageLow(), line=26 bci=8

26            double percentageUsed = ((double) usedMemory) / maxMemory;

 

Thread-0[1] where

  [1] MemoryWarningSystem$1.memoryUsageLow (MemoryWarningSystem.java:26)

  [2] MemoryWarningSystem$2.handleNotification (MemoryWarningSystem.java:48)

  [3] javax.management.NotificationBroadcasterSupport.handleNotification (NotificationBroadcasterSupport.java:284)

  [4] javax.management.NotificationBroadcasterSupport$SendNotifJob.run (NotificationBroadcasterSupport.java:361)

  [5] java.lang.Thread.run (Thread.java:844)

Thread-0[1] step

> 

Step completed: "thread=Thread-0", MemoryWarningSystem$1.memoryUsageLow(), line=27 bci=15

27            System.out.println("percentageUsed = " + percentageUsed);

 

Thread-0[1] list

23        mws.addListener(new MemoryWarningSystem.Listener() {

24          public void memoryUsageLow(long usedMemory, long maxMemory) {

25            System.out.println("Memory usage low!!!");

26            double percentageUsed = ((double) usedMemory) / maxMemory;

27 =>         System.out.println("percentageUsed = " + percentageUsed);

28            MemoryWarningSystem.setPercentageUsageThreshold(0.8);

29          }

30        });

31    

32        Collection<Double> numbers = new LinkedList<Double>();

Thread-0[1]

 

In the change, the class ‘MemoryImpl’ is derived from class ‘NotificationBroadcasterSupport’ instead of class ‘NotificationEmitterSupport’ 

NotificationBroadcastSupport takes an Executor, MemoryImpl constructor  call super() with an executor,  a visible thread.

 

The method hasListeners() is referenced  inside MemoryImpl.java and defined in  NotificationEmitterSupport.

This method is not present in  NotificationBroadcasterSupport so I added it to NotificationBroadcasterSupport.

 

Jdk10 bug: https://bugs.openjdk.java.net/browse/JDK-8170299

Webrev link: HYPERLINK "http://cr.openjdk.java.net/%7Eshshahma/8170299/webrev.01/"http://cr.openjdk.java.net/~shshahma/8170299/webrev.01/

 

Testing: jprt -testset core, vm tonga tests nsk.jvmti.testlist, nsk.jdi.testlist, nsk.jdwp.testlist and jtreg tests ./jdk/test/com/sun/jdi/

 

Please let me know if I missed to test some more test suit[s].

 

Thanks to Mandy and Poonam for helping me in fixing this. 

 

Regards,

Shafi

 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20170906/1428ce25/attachment-0001.html>


More information about the serviceability-dev mailing list