Increased server CPU when custom key changes

Hi guys

I’m leaving a message because I’m having trouble with the game we’re trying to live this time.

The current versions we are using are nakama:3.20.1, cockroachdb/cockroach:latest-v23.1, cocos creator, and we are currently running your server on aws ec2 (T3.Xlarge).

The problem is that when using a saved session, if the custom_id changes in the meantime (in our case, the device identification ID), the CPU usage on the server skyrockets to 100%.

[How to reproduce]

  • First, connect the device to Android Studio and proceed in the following order.
  1. Build a debug version on Android and connect to the game server.
  2. Then, save the session used when connecting to the server.
  3. Build a release version on Android (the device identification ID changes at this time).
  4. Then, connect to the server.

In this case, the client judged the ID to be non-existent and made an exception to initialize the session, but the server’s CPU suddenly skyrockets to 100% and the server goes down.

This phenomenon is still continuing when the client was using it before. nakama: It didn’t happen in 3.11.0, but it keeps happening after the upgrade.

First of all, since the above example may not be applicable, let me tell you about an additional problem that can cause this problem. The same problem can occur even when you don’t share sessions when connecting to the server based on load balancer. I’m leaving an inquiry because I’m worried about this part.

Should we downgrade again?

Hello @Gandangf,

We’re not aware of any regression in device authentication that would explain this.

We’ll need more information to be able to help:
Do you see any crash in the server? Do you observe anything happening in a loop in the logs? Any errors? Do you have custom code, before or after hooks?

Any additional information you can provide would be useful, as it stands it’s difficult to understand what could make the CPU spike in such a way.

Best.