Object returned from OQL query in jhat does not match query

260 views Asked by At

Our team has a Java process running (on a 64-bit server OpenJDK 1.8.0_171-b10) in which some unexplainable things happen regarding the value of (boxed) Long objects. We have created a heap dump to analyse with jhat and here something really strange occurs.

Having jhat running, we issue one of the following OQL queries:

  • select l from java.lang.Long l where l.value.toString().equals("20180919141719600")
  • select l from java.lang.Long l where l.value == 20180919141719600

Both result in the same three objects being returned. However, when we inspect the objects, all three have a different value in value and neither of those equals 20180919141719600.

This in itself bothers us and is the core of our question.

Additionally, we can make the situation a bit more interesting. It seems as if the running Java code uses the actual values (as we see using jhat in the value field of the Long objects), except in JSON serialisation, because the REST endpoint returns the value 20180919141719600. This signals that somehow both values are actually in memory (and heap dump) and somehow JSON serialisation (using Jackson) does something different, congruent to what jhat does when running OQL queries.

What would be the next step to analyse this situation?

0

There are 0 answers