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

jvmstat fails to send updates to listener on unchecked exception

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u111
    • Fix Version/s: tbd
    • Component/s: core-svc
    • Labels:

      Description

      Users using the jvmstat API might register a VmListener in order to get notified on monitor updates (fireMonitorsUpdatedEvents() in LocalMonitoredVm.java).

      Internally a Timer is used to notify listeners on a given interval. However, when a NotifierTask throws an unchecked exception, the Timer dies, preventing any further updates for any monitors.

      One such instance where a runtime exception might occur in NotifierTask is when a JVM is currently active waiting for a debugger to attach.

      This could be a potential fix:
      diff --git a/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/LocalMonitoredVm.java b/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/LocalMonitoredVm.java
      --- a/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/LocalMonitoredVm.java
      +++ b/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/LocalMonitoredVm.java
      @@ -202,6 +202,11 @@
                       System.err.println("Exception updating monitors for "
                                          + getVmIdentifier());
                       e.printStackTrace();
      + } catch (Throwable e) {
      + // XXX: use logging api
      + System.err.println("Exception updating monitors for "
      + + getVmIdentifier());
      + e.printStackTrace();
                   }
               }
           }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              sgehwolf Severin Gehwolf
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: