org.infinispan.server.hotrod.InvalidMagicIdException: Error reading magic byte or message error connecting to Data Grid via Spring Boot client

Solution Verified - Updated -

Environment

  • Red Hat JBoss Data Grid
    • 7.x

Issue

  • While trying to connect to JDG 7.2 via Spring Boot application version 2.x, the error org.infinispan.server.hotrod.InvalidMagicIdException: Error reading magic byte or message is appearing in the logs
  • Can't connect to a JDG server 7.2.x using a Spring Boot application

Resolution

Given a Hot Rod misconfiguration: The Hot Rod version can be changed. Meaning a workaround is to use Hot Rod protocol version 2.5 by setting the parameter infinispan.client.hotrod.protocol_version = 2.5 in the Spring Boot application properties file.

Given a scenario of something accessing the Hot Rod port: this needs to be investigated.

Root Cause

Hot Rod client would always be the same ID, given a wrong/misconfigured connection the same id will be printed on the JDG server logs.
Two possible root causes: the Hot Rod is misconfigured or there is something trying to access the Hot Rod port.

Hot Rod misconfiguration

Red Hat JBoss Data Grid 7.2.x is based on Infinispan 9.4.x and not certified on Spring Boot 2.x libraries.
Spring Boot 1.5.17 and 2.x have been tested for integration with RHDG 7.3. See Red Hat Data Grid 7 Supported Configurations.

Access to HotRod port

Hot Rod client would always be the same ID. (even if it's the wrong one because it's a different version not configured correctly)
Therefore, when searching on InvalidMagicIdException see the IDs, in case it changes (example several ids different) so investigate if there isn't something else accessing the Hot Rod port.

Diagnostic Steps

  1. See DG logs org.infinispan.server.hotrod.InvalidMagicIdException: Error reading magic byte or message message.
  2. If the InvalidMagicIdException has the same ids and periodic, so it is the hot rod client accessing
  3. Otherwise, in case InvalidMagicIdException changes the ids so it is not the same Hot Rod client given that each client will have its own unique id.
  4. In case there are several ids in a very short timeframe, look for which application is trying to access the Hot Rod.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments