Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unity: Compensating Write Errors not Logged as Errors #3642

Closed
moritz-mg opened this issue Jul 9, 2024 · 4 comments
Closed

Unity: Compensating Write Errors not Logged as Errors #3642

moritz-mg opened this issue Jul 9, 2024 · 4 comments
Assignees
Labels
App-type:Unity More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. O-Community SDK-Use:Sync T-Bug

Comments

@moritz-mg
Copy link

moritz-mg commented Jul 9, 2024

What happened?

When certain errors occur, such as compensating writes, the errrors are logged with Debug.Log instead of Debug.LogError or Debug.LogException (or the respective UnityLogger function) in Unity.

This makes compensating writes difficult to spot.

image

Repro steps

  1. Make Unity Project :)
  2. Write to an object that realm rules disallow this client to write to
  3. Observe - plain "Log" entries, even though the condition should be treated as an error log.

Version

12.1.0

What Atlas Services are you using?

Atlas Device Sync

What type of application is this?

Unity

Client OS and version

UnityEditor (Windows)

Code snippets

No response

Stacktrace of the exception/crash you're getting

2024-07-09 08:17:08.264 Info: Connection[1]: Session[7]: Received: ERROR "Client attempted a write that is not allowed; it has been reverted" (error_code=231, is_fatal=false, error_action=Warning)
UnityEngine.Debug:Log (object)
UnityUtils.UnityLogger:LogImpl (Realms.Logging.LogLevel,string)
Realms.Logging.Logger:Log (Realms.Logging.LogLevel,string)
Realms.Logging.Logger:LogDefault (Realms.Logging.LogLevel,string)
Realms.SharedRealmHandle:LogMessage (Realms.Native.StringValue,Realms.Logging.LogLevel)
2024-07-09 08:17:08.376 Info: Connection[1]: Session[1]: Reporting compensating write for client version 221 in server version 44653: Client attempted a write that is not allowed; it has been reverted
UnityEngine.Debug:Log (object)
UnityUtils.UnityLogger:LogImpl (Realms.Logging.LogLevel,string)
Realms.Logging.Logger:Log (Realms.Logging.LogLevel,string)
Realms.Logging.Logger:LogDefault (Realms.Logging.LogLevel,string)
Realms.SharedRealmHandle:LogMessage (Realms.Native.StringValue,Realms.Logging.LogLevel)


### Relevant log output

_No response_
@moritz-mg moritz-mg added the T-Bug label Jul 9, 2024
@moritz-mg moritz-mg changed the title Unity: Erros not Logged as Errors Unity: Compensating Write Errors not Logged as Errors Jul 9, 2024
Copy link

sync-by-unito bot commented Jul 9, 2024

➤ PM Bot commented:

Jira ticket: RNET-1166

@nirinchev
Copy link
Member

@danieltabacaru this is logged from the sync client - do we think it'd make sense to move the log level for these to Error or is Info the right place, considering these errors are not fatal?

@danieltabacaru
Copy link

@nirinchev I think Info is fine.
@moritz-mg If you need to keep track of (any) errors, you should do it in the error handler.

@nirinchev
Copy link
Member

@moritz-mg for more context, you can setup an error handler like:

var config = new FlexibleSyncConfiguration(...)
{
    OnSessionError = (session, error) =>
    {
        if (error is CompensatingWriteException cwe)
        {
            foreach (var info in cwe.CompensatingWrites)
            {
                // log write info at whatever level makes sense for your project
            }
        }
    }
}

@nirinchev nirinchev added the More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. label Jul 9, 2024
@nirinchev nirinchev self-assigned this Jul 9, 2024
@sync-by-unito sync-by-unito bot closed this as completed Jul 22, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
App-type:Unity More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. O-Community SDK-Use:Sync T-Bug
Projects
None yet
Development

No branches or pull requests

3 participants