We found a number of new accounts that are not being given critical initial metadata/wallet/storage data in authentication after hooks.
After searching for a while, we discovered the issue is being caused by the error timeout: context canceled in a storage request to read the default account configuration from a record.
Searching the issue, we found several forum posts (here and here) explaining why this is happening. To my understanding, the context is cancelled on client disconnect to reduce load, presuming the client won't be there to receive a response. The only problem is that we don't want nor expect this optimization. We now have dozens of accounts that are unable to use core features of our application due to metadata/wallet/storage records that were never initialized.
We're looking for a simple way to circumvent or disable this behavior in our Lua backend. If we can save resources by allowing storage operations to cancel on client disconnect, that should be an opt-in parameter.
Steps to Reproduce
Add an after hook to AuthenticateEmail that performs storage operations
(??) we're not sure, perhaps people have bad connections or are closing the game in the middle of an auth request
Logs show timeout: context canceled for important storage operations
Expected Result
Code should only error if Nakama loses DB connection or a DB operation takes way too long.
Actual Result
Code can error anywhere we make DB requests.
Context
Godot client, Lua backend
Your Environment
Nakama 3.10 (forked from 1d0527e0)
Postgres
Docker
Description
We found a number of new accounts that are not being given critical initial metadata/wallet/storage data in authentication after hooks.
After searching for a while, we discovered the issue is being caused by the error
timeout: context canceled
in a storage request to read the default account configuration from a record.Searching the issue, we found several forum posts (here and here) explaining why this is happening. To my understanding, the context is cancelled on client disconnect to reduce load, presuming the client won't be there to receive a response. The only problem is that we don't want nor expect this optimization. We now have dozens of accounts that are unable to use core features of our application due to metadata/wallet/storage records that were never initialized.
We're looking for a simple way to circumvent or disable this behavior in our Lua backend. If we can save resources by allowing storage operations to cancel on client disconnect, that should be an opt-in parameter.
Steps to Reproduce
timeout: context canceled
for important storage operationsExpected Result
Code should only error if Nakama loses DB connection or a DB operation takes way too long.
Actual Result
Code can error anywhere we make DB requests.
Context
Godot client, Lua backend
Your Environment
Nakama 3.10 (forked from 1d0527e0) Postgres Docker