Pivotal Knowledge Base

Follow

IllegalStateException: Unknown PDX Type on Client Side

Environment

GemFire Version 6.x and above

Symptom

This document describes a Portable Data eXchange (PDX) related exception that may occur when restarting a distributed system without also restarting any clients.

When using PDX serialization without persistence, the following exception may be seen on a client after bouncing all of the servers of the distributed system without restarting the client:

Caused by: java.lang.IllegalStateException: Unknown pdx type=X
 at com.gemstone.gemfire.internal.InternalDataSerializer.readPdxSerializable(InternalDataSerializer.java:2977)
 at com.gemstone.gemfire.internal.InternalDataSerializer.basicReadObject(InternalDataSerializer.java:2794)
 at com.gemstone.gemfire.DataSerializer.readObject(DataSerializer.java:3212)
 at com.gemstone.gemfire.internal.util.BlobHelper.deserializeBlob(BlobHelper.java:81)
 at com.gemstone.gemfire.internal.cache.EntryEventImpl.deserialize(EntryEventImpl.java:1407)
 at com.gemstone.gemfire.internal.cache.PreferBytesCachedDeserializable.getDeserializedValue(PreferBytesCachedDeserializable.java:65)
 at com.gemstone.gemfire.cache.query.internal.index.DummyQRegion.getValues(DummyQRegion.java:153)
 at com.gemstone.gemfire.cache.query.internal.index.DummyQRegion.values(DummyQRegion.java:109)
 at com.gemstone.gemfire.cache.query.internal.index.DummyQRegion.iterator(DummyQRegion.java:198)
 at com.gemstone.gemfire.cache.query.internal.index.CompactRangeIndex$IMQEvaluator.doNestedIterations(CompactRangeIndex.java:1763)
 at com.gemstone.gemfire.cache.query.internal.index.CompactRangeIndex$IMQEvaluator.evaluate(CompactRangeIndex.java:1622)
 ... 27 more

Cause

The problem occurs because of the lack of persistence for the PDX metadata on server members. Due to the fact that cache servers are restarted and cache client is not, the client holds old PDX types that are not present on the servers. This causes the types to get out of synchronization between the client and the server.

Resolution

To avoid this issue without persisting PDX types on server members, you must restart your client application when restarting the servers. Alternately, to avoid this issue without restarting your client application, you must enable PDX persistence on servers. By doing this, you are guaranteed that any already defined PDX types will remain available between server restarts. This doesn't require to store the data from your regions, you can store only PDX metadata, regions data, or both.

Below mentioned is an example of how to configure PDX persistence on the server side:

<disk-store name="pdxDiskStore">
    <disk-dirs>
        <disk-dir>pdxDiskStore</disk-dir>
    </disk-dirs>
</disk-store>

<pdx read-serialized="true" persistent="true" disk-store-name="pdxDiskStore"/>

Comments

Powered by Zendesk