Search code examples
javaignite

Apache Ignite org.apache.ignite.internal.client.thin.ClientProtocolError "Invalid response size" and "Unexpected response ID"


I have a dockerized ignite instance and a dockerized java program in the same server. Ignite has a cache defined by the config xml and the java connects to it through a thin client and the cache is filled by another service. The java only does a get to ignite to get the key values.

Everything has been working as expected with this errors appearing sometimes and recreating the java docker resolved it. Today java started to show this errors every time, appearing after a few seconds of running under some load and I am not able to solve it. Already tried to empty the cache or to stop the service that fills it.

The exceptions are the following:

org.apache.ignite.internal.client.thin.ClientProtocolError: Unexpected response ID [4595132326738094176]
    at org.apache.ignite.internal.client.thin.TcpClientChannel.processNextResponse(TcpClientChannel.java:284)
    at org.apache.ignite.internal.client.thin.TcpClientChannel.receive(TcpClientChannel.java:234)
    at org.apache.ignite.internal.client.thin.TcpClientChannel.service(TcpClientChannel.java:171)
    at org.apache.ignite.internal.client.thin.ReliableChannel.service(ReliableChannel.java:180)
    at org.apache.ignite.internal.client.thin.ReliableChannel.affinityService(ReliableChannel.java:242)
    at org.apache.ignite.internal.client.thin.TcpClientCache.cacheSingleKeyOperation(TcpClientCache.java:509)
    at org.apache.ignite.internal.client.thin.TcpClientCache.get(TcpClientCache.java:111)
    at com.abc.rtpm.RtpmClient.getPrice(RtpmClient.java:63)

org.apache.ignite.internal.client.thin.ClientProtocolError: Invalid response size: -1476395008
    at org.apache.ignite.internal.client.thin.TcpClientChannel.processNextResponse(TcpClientChannel.java:275)
    at org.apache.ignite.internal.client.thin.TcpClientChannel.receive(TcpClientChannel.java:234)
    at org.apache.ignite.internal.client.thin.TcpClientChannel.service(TcpClientChannel.java:171)
    at org.apache.ignite.internal.client.thin.ReliableChannel.service(ReliableChannel.java:180)
    at org.apache.ignite.internal.client.thin.ReliableChannel.affinityService(ReliableChannel.java:242)
    at org.apache.ignite.internal.client.thin.TcpClientCache.cacheSingleKeyOperation(TcpClientCache.java:509)
    at org.apache.ignite.internal.client.thin.TcpClientCache.get(TcpClientCache.java:111)
    at com.abc.rtpm.RtpmClient.getPrice(RtpmClient.java:63)

The client is created by the following code:

this.cfg = new ClientConfiguration().setAddresses(clientHost + ":" + clientPort);
try {
    this.igniteClient = Ignition.startClient(this.cfg);
    this.cache = this.igniteClient.getOrCreateCache("rtpm");
}
catch (ClientException e) {
    System.err.println(e.getMessage());
}
catch (Exception e){
    System.err.format("Unexpected failure: %s\n", e);
}

There are several threads calling the get simultaneously.

Any help is much appreciated.


Solution

  • Although in the thin client docs it says it supports multithreading it seems it cannot hold the load.

    I solved this using a regular client.