[ https://issues.apache.org/jira/browse/GEODE-7957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17089845#comment-17089845 ]
ASF subversion and git services commented on GEODE-7957: -------------------------------------------------------- Commit 1ddd7de1d9b6c7c37f14db06f98acb769bd99b68 in geode's branch refs/heads/develop from Jason Huynh [ https://gitbox.apache.org/repos/asf?p=geode.git;h=1ddd7de ] GEODE-7957: query results toData will write to correct output stream (#4922) * Previously, when a query is executed in a function, the toData on specific results set types would write directly to the wrong output stream, causing deserialization issues > Serializing and deserializing a CumulativeNonDistinctResults containing > Structs fails with either an OutOfMemoryError or an IllegalArgumentException > ---------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: GEODE-7957 > URL: https://issues.apache.org/jira/browse/GEODE-7957 > Project: Geode > Issue Type: Bug > Components: querying > Affects Versions: 1.12.0 > Reporter: Barrett Oglesby > Assignee: Jason Huynh > Priority: Major > Labels: GeodeCommons > Time Spent: 1.5h > Remaining Estimate: 0h > > Executing a query like: > {noformat} > 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 > {noformat} > Using a function that does: > {noformat} > QueryService queryService = CacheFactory.getAnyInstance().getQueryService(); > Query query = queryService.newQuery(queryStr); > SelectResults results = (SelectResults) query.execute(rfc); > context.getResultSender().lastResult(results); > {noformat} > Causes one of two exceptions when the CumulativeNonDistinctResults is > deserialized. > Either an IllegalArgumentException on the client like: > {noformat} > 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) > {noformat} > Or an OutOfMemoryError on the server like: > {noformat} > 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) > {noformat} > CumulativeNonDistinctResults.toData does: > {noformat} > HeapDataOutputStream hdos = new HeapDataOutputStream(1024, null); > LongUpdater lu = hdos.reserveLong(); > ... > DataSerializer.writeObjectArray(fields, out); > ... > lu.update(numElements); > {noformat} > NWayMergeResults.toData is broken in the same way > The fix is to write the fields to hdos instead of out like: > {noformat} > DataSerializer.writeObjectArray(fields, hdos); > {noformat} > A work-around in the function is to convert the CumulativeNonDistinctResults > to a List like: > {noformat} > context.getResultSender().lastResult(results.asList()); > {noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005)