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

Daniel D. Daugherty daniel.daugherty at oracle.com
Tue Sep 5 17:06:05 UTC 2017


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" 
> <daniel.daugherty at oracle.com <mailto: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:
>>     http://cr.openjdk.java.net/~shshahma/8170299/webrev.01/
>>     <http://cr.openjdk.java.net/%7Eshshahma/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/20170905/12d08ca1/attachment.html>


More information about the serviceability-dev mailing list