RES: Got a change for something I didn't sub to

@Accipiter this is something I never saw before and I’m mildly curious as to if that’s on me or some server-side desync.

<InvalidMessageException "received an event for unknown rid core.char.cam4cp69gbrqf706fs7g": {"id":null,"result":null,"error":null,"event":"core.char.cam4cp69gbrqf706fs7g.change","data":{"values":{"idle":1}}}>

I treat change events for things I don’t have in the cache as errors because I never expect to get an update for something that I don’t have a full state on. I cannot have a full state on this particular RID as I just restarted the client (and so its memory state is blank).

One thing that I do in this bot that I never had to do before is subscribing to core.chars.awake.

Unfortunately I don’t have the full log of the interactions, but given that the dart client is single-threaded I’m pretty sure there’s no out-of-order message handling.

Should I just drop those to the floor instead of crashing the socket?

1 Like

Interesting. Ofcourse, this shouldn’t happen.
Resgate also runs all events on a single goroutine (light weight thread) per connection, so events for a resource should never be sent if it is no longer considered subscribed.

If the bug lies in the client, I would start looking at the following two scenarios:

Multiple indirect subscriptions

Let’s consider the following steps:

  1. Get core.chars.awake
  2. Character model is included in the response and indirectly subscribed
  3. Get another resource that indirectly includes the same character model.
  4. Receive a ’remove’ event on core.chars.awake, removing the character model
  5. … The client should NOT remove the model from the cache due to step 4, because it still has another indirect subscription because of step 3.

Not counting direct subscription from getChar response

A resource response to a call request is to be counted as a direct subscription, similar as if you called get.core.char.cam4cp69gbrqf706fs7g.
Consider the above steps, but replace step 3 with calling getChar.

Those are two scenarios I could imagine.
But to know for real, I would need the clients we socket logs to analyze.

(Posted from phone. I will skip proofreading)

2 Likes