-
Bug
-
Resolution: Fixed
-
P3
-
9.0.4, 10
-
b11
-
generic
-
generic
FULL PRODUCT VERSION :
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Darwin 17.3.0 Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
I am seeing the same problem mentioned in:
https://bugs.openjdk.java.net/browse/JDK-8027635
Only on java 9 (that bug was marked as fixed in 7u40). I do not see the problem when using java 8.
Some additional details at: https://github.com/Netflix/spectator/issues/502
REGRESSION. Last worked in version 8u172
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Change in amount used for G1 Eden Space after GC.
ACTUAL -
No change in amount used for G1 Eden Space after GC.
REPRODUCIBILITY :N
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
// This is from https://bugs.openjdk.java.net/browse/JDK-8027635
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import java.lang.management.PlatformManagedObject;
import java.util.ArrayList;
import java.util.List;
import javax.management.Notification;
import javax.management.NotificationEmitter;
import javax.management.NotificationListener;
import javax.management.openmbean.CompositeData;
import com.sun.management.GarbageCollectionNotificationInfo;
/**
*
*/
public class NotificationTest {
public static void main(String[] args) {
for (GarbageCollectorMXBean bean : ManagementFactory.getGarbageCollectorMXBeans()) {
addNotificationListener(bean);
}
List<String> strings = new ArrayList<String>();
for(int i=0;i<10000;i++) {
System.out.println(i);
}
System.gc();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
public static void addNotificationListener(PlatformManagedObject mbs) {
if (mbs instanceof NotificationEmitter) {
NotificationEmitter emitter = (NotificationEmitter)mbs;
emitter.addNotificationListener(new NotificationListener() {
@Override
public void handleNotification(Notification notification, Object handback) {
String notifType = notification.getType();
if (notifType.equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
// retrieve the garbage collection notification information
GarbageCollectionNotificationInfo info = GarbageCollectionNotificationInfo.from((CompositeData)notification
.getUserData());
System.out.println(info.getGcInfo().getMemoryUsageBeforeGc());
System.out.println(info.getGcInfo().getMemoryUsageAfterGc());
}
}
}, null, null);
}
}
}
---------- END SOURCE ----------
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Darwin 17.3.0 Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
I am seeing the same problem mentioned in:
https://bugs.openjdk.java.net/browse/JDK-8027635
Only on java 9 (that bug was marked as fixed in 7u40). I do not see the problem when using java 8.
Some additional details at: https://github.com/Netflix/spectator/issues/502
REGRESSION. Last worked in version 8u172
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Change in amount used for G1 Eden Space after GC.
ACTUAL -
No change in amount used for G1 Eden Space after GC.
REPRODUCIBILITY :N
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
// This is from https://bugs.openjdk.java.net/browse/JDK-8027635
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import java.lang.management.PlatformManagedObject;
import java.util.ArrayList;
import java.util.List;
import javax.management.Notification;
import javax.management.NotificationEmitter;
import javax.management.NotificationListener;
import javax.management.openmbean.CompositeData;
import com.sun.management.GarbageCollectionNotificationInfo;
/**
*
*/
public class NotificationTest {
public static void main(String[] args) {
for (GarbageCollectorMXBean bean : ManagementFactory.getGarbageCollectorMXBeans()) {
addNotificationListener(bean);
}
List<String> strings = new ArrayList<String>();
for(int i=0;i<10000;i++) {
System.out.println(i);
}
System.gc();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
public static void addNotificationListener(PlatformManagedObject mbs) {
if (mbs instanceof NotificationEmitter) {
NotificationEmitter emitter = (NotificationEmitter)mbs;
emitter.addNotificationListener(new NotificationListener() {
@Override
public void handleNotification(Notification notification, Object handback) {
String notifType = notification.getType();
if (notifType.equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
// retrieve the garbage collection notification information
GarbageCollectionNotificationInfo info = GarbageCollectionNotificationInfo.from((CompositeData)notification
.getUserData());
System.out.println(info.getGcInfo().getMemoryUsageBeforeGc());
System.out.println(info.getGcInfo().getMemoryUsageAfterGc());
}
}
}, null, null);
}
}
}
---------- END SOURCE ----------
- relates to
-
JDK-8027635 G1 GarbageCollectionNotificationInfo has same information for before and after
-
- Closed
-