Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-7957

Serializing and deserializing a CumulativeNonDistinctResults containing Structs fails with either an OutOfMemoryError or an IllegalArgumentException

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.12.0
    • Fix Version/s: 1.13.0
    • Component/s: querying
    • Labels:

      Description

      Executing a query like:

      SELECT pnl.TM_ID, pnl.PTD_ACCRETION_INV_AMT, pnl.FIRM_ACCT_ID, pnl.INSM_ID, adj.PL_POSN_ID , adj.DLY_ACCRETION_INV_AMT FROM /PnLPosition4 pnl , /AdjustmentPosition4 adj where adj.PL_POSN_ID = pnl.PL_POSN_ID
      

      Using a function that does:

      QueryService queryService = CacheFactory.getAnyInstance().getQueryService();
      Query query = queryService.newQuery(queryStr);
      SelectResults results = (SelectResults) query.execute(rfc);
      context.getResultSender().lastResult(results);
      

      Causes one of two exceptions when the CumulativeNonDistinctResults is deserialized.

      Either an IllegalArgumentException on the client like:

      Caused by: java.lang.IllegalArgumentException: unexpected typeCode: 46
      	at org.apache.geode.internal.serialization.StaticSerialization.decodePrimitiveClass(StaticSerialization.java:502)
      	at org.apache.geode.DataSerializer.readObjectArray(DataSerializer.java:1744)
      	at org.apache.geode.cache.query.internal.CumulativeNonDistinctResults.fromData(CumulativeNonDistinctResults.java:293)
      	at org.apache.geode.internal.serialization.internal.DSFIDSerializerImpl.invokeFromData(DSFIDSerializerImpl.java:332)
      	at org.apache.geode.internal.serialization.internal.DSFIDSerializerImpl.create(DSFIDSerializerImpl.java:383)
      

      Or an OutOfMemoryError on the server like:

      java.lang.OutOfMemoryError: Java heap space
      	at java.util.ArrayList.<init>(ArrayList.java:152)
      	at org.apache.geode.cache.query.internal.CumulativeNonDistinctResults.fromData(CumulativeNonDistinctResults.java:289)
      	at org.apache.geode.internal.serialization.internal.DSFIDSerializerImpl.invokeFromData(DSFIDSerializerImpl.java:332)
      	at org.apache.geode.internal.serialization.internal.DSFIDSerializerImpl.create(DSFIDSerializerImpl.java:383)
      	at org.apache.geode.internal.DSFIDFactory.create(DSFIDFactory.java:1018)
      	at org.apache.geode.internal.InternalDataSerializer.basicReadObject(InternalDataSerializer.java:2508)
      	at org.apache.geode.DataSerializer.readObject(DataSerializer.java:2864)
      

      CumulativeNonDistinctResults.toData does:

      HeapDataOutputStream hdos = new HeapDataOutputStream(1024, null);
      LongUpdater lu = hdos.reserveLong();
      ...
      DataSerializer.writeObjectArray(fields, out);
      ...
      lu.update(numElements);
      

      NWayMergeResults.toData is broken in the same way

      The fix is to write the fields to hdos instead of out like:

      DataSerializer.writeObjectArray(fields, hdos);
      

      A work-around in the function is to convert the CumulativeNonDistinctResults to a List like:

      context.getResultSender().lastResult(results.asList());
      

        Attachments

          Activity

            People

            • Assignee:
              jasonhuynh Jason Huynh
              Reporter:
              boglesby Barrett Oglesby

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1.5h
                1.5h

                  Issue deployment