Error reading message from client / websocket: close 1006 (abnormal closure): unexpected EOF

Good day.
Last night, while testing the app, some data was not being fetched from the server. I tried multiple times in different internet connections and different platforms.
Today this issue has been fixed without any changes from my part.

Here is the full error I got last night, when I was trying to read some data.

2019-10-23T11:05:01.460Z
Error reading message from client
{“uid”:“372008c9-0a90-4ce8-839e-439069c64cc5”,“sid”:“f752e208-fa01-4e1b-be20-15ea18948c1c”,“error”:“websocket: close 1006 (abnormal closure): unexpected EOF”}

Some real-time socket operations kept working normally (chat, RPC function calls, etc.), but some crucial data never got fetched from the server, which means that some functionalities would not be accessible, but since it didn’t break the app, no user would know of the issue, which would be very bad for our application case.

Lately, I and my team have been adding new RPC functions to our server, so maybe this is related since the data is being fetched using the Nakama modules with RPC functions.

What could be causing this odd behaviour? and is there something I can do so this never happens again?

1 Like

@Lintzmaia Where do you run the servers? Is it on our Managed Cloud or somewhere managed yourselves?

We use Managed Cloud

Last night, while testing the app, some data was not being fetched from the server.

What data was not being fetched?

but some crucial data never got fetched from the server, which means that some functionalities would not be accessible,

Interesting so the socket connection was fine but the critical data for your app to work correctly is not returned. This makes me think the logs you shared are a misnomer. Those logs usually just indicate that the connection got closed with a bad disconnect. i.e. The game client lost network connection. These are quite normal to see.

What could be causing this odd behaviour? and is there something I can do so this never happens again?

We need to understand together the root cause of the issue so we can be sure it’ll never happen again. Do you have a way to reproduce the behaviour?

A string of users registered to a group on a key, inside a collection. Something like key:“Usernames” collection groupname + “accounts”.
This is the returned value now that it works:
{“List”:[“Judy”,“Thiago”,“Test”,“Test2”,“AppendTest”]}

I could not replicate and I know how this makes things a lot more difficult. I uploaded a new version of the RPC function I been working, but the server worked fine this time, so I don’t think that would be the issue.

But anyway, here’s the lua script I use to fetch this data, have not been changed in months:

And here is the lua script I uploaded some hours before the issue:

1 Like

Thanks for the details @Lintzmaia.

A string of users registered to a group on a key, inside a collection. Something like key:“Usernames” collection groupname + “accounts”.

What sort of reason to you store and capture the data this way? Is it for some kind of player referral tracking in the game signups?

I could not replicate and I know how this makes things a lot more difficult.

Thanks I’ll run some tests with your original Lua code. Was the Lua registered RPC function executed over the socket or as a client RPC?

I use it so I can check if the user exists on a group before doing any further requests on the login process and also to build a list of all users on a group.

I’m not 100% sure about this, but I believe it is a client rpc call. Here’s the line I use to call the RPC in Unity

where _client is a IClient variable.

Only now I noticed there was a way to call the RPC function with the socket. What is the difference between the two?

Thanks for helping me with this!

I use it so I can check if the user exists on a group before doing any further requests on the login process and also to build a list of all users on a group.

Why not use the groups feature in the server for this functionality?

Only now I noticed there was a way to call the RPC function with the socket. What is the difference between the two?

There’s not much difference between the execution itself on or off the socket object. If you wanted to execute logic which relied on the session_id then you’d need to perform the request on the socket.

I’m not sure what more can be done except to keep an eye and see if you can reproduce the issue again. I do believe that the original indication that it’s linked to the websocket close message is a misnomer though. That’s a normal message that occurs with an abrupt client disconnect (like the player has lost network access over 3G/4G for example).

Having to list with just the name of all users on a group was not something expected from day one, since there’s a lot more data each user holds that must be fetched when some when the app starts, I would just fetch all the data from each user and build a user list after.
This list of users was just a quick fix since I did not want to add the group feature for just this function.
Now there’s a lot of users using our app and to change something like this would need a lot of smaller updates. Since there’s always a higher priority task, I won’t be able to change to it in a while.

Ok, I will keep an eye out.

Thanks for your time and help!