RFR: 8261160: Add a deserialization JFR event

Erik Gahlin egahlin at openjdk.java.net
Thu Feb 11 07:02:41 UTC 2021


On Tue, 9 Feb 2021 12:35:27 GMT, Chris Hegarty <chegar at openjdk.org> wrote:

> This issue adds a new event to improve diagnostic information of Java deserialization. The event captures the details of deserialization activity from ObjectInputStream. The event details are similar to that of the serial filter, but is agnostic of whether a filter is installed or not. The event also captures the filter status, if there is one.

src/java.base/share/classes/java/io/ObjectInputStream.java line 1366:

> 1364:         DeserializationEvent event = new DeserializationEvent();
> 1365:         if (event.shouldCommit()) {
> 1366:             event.filterStatus = status == null ? "n/a" : status.name();

We use null for missing value, so no need to have "n/a"

src/java.base/share/classes/java/io/ObjectInputStream.java line 1372:

> 1370:             event.depth = depth;
> 1371:             event.bytesRead = bytesRead;
> 1372:             event.exception = Objects.toString(ex, "n/a");

You may want to change the name of the field to "exceptionMessage" to make it clear it's the message, not the class.

src/jdk.jfr/share/classes/jdk/jfr/events/DeserializationEvent.java line 45:

> 43: 
> 44:     @Label ("Class")
> 45:     public String clazz;

We typically use "type" when referring to a class.

src/jdk.jfr/share/classes/jdk/jfr/events/DeserializationEvent.java line 45:

> 43: 
> 44:     @Label ("Class")
> 45:     public String clazz;

Is it possible to make the field of type Class?

src/jdk.jfr/share/classes/jdk/jfr/events/DeserializationEvent.java line 51:

> 49: 
> 50:     @Label ("Reference count")
> 51:     public long totalObjectRefs;

"Reference count" sounds a bit like resource counter? Is that the case? If not, perhaps "Object References" is better. We tried to avoid abbreviations. How about naming the field "totalObjectReferences" or just "objectReferences"?

-------------

PR: https://git.openjdk.java.net/jdk/pull/2479



More information about the security-dev mailing list