-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
1 - XS (<= 1 day)
-
2717
What happened?
It's not as straightforward as the title suggests, but basically, the app runs at 1 frame every 5 seconds if I restart it offline after waiting for about 10 minutes with the app minimized.
If I remove the call to Realm.GetInstance the issue goes away, but it's not exactly this line that causes it, it actually returns the Realm as it should. So when the app was unresponsive I paused it to see what it was doing on the main thread, and every single time the app was stuck at this line (see attached stacktrace):
The URL of the HTTP call was a Realm Auth endpoint.
I don't know if this problem could have been originated server-side because I only noticed this issue recently even though I installed an older version of the app (from 3 months ago) and still could reproduce it. If this problem is really a bug present locally in realm-dotnet, I think we would have noticed it sooner given that it is so easily reproduced.
I tested both on our main MongoDB Realm synced with an Atlas M10 cluster and on a MongoDB Realm for testing purposes on an M0, it's unlikely that it's being caused by something particular to a single MongoDB Realm even if the issue is really originated server-side.
Repro steps
- Start the app while online
- Minimize the app and lock phone (I'm fairly sure the issue will happen even if the app is not minimized or the phone is not locked, but this is the most consistent way of reproducing)
- Wait for about 10 minutes on Android or 15 minutes on iOS (sometimes it takes less time, but again, this is the most consistent way to reproduce)
- Turn on airplane mode, maximize the app and then force close it
- Open it again while airplane mode is still on
This may look like too much work to reproduce, but in a real-world scenario, it's actually very common:
- User starts an app online
- The app gets terminated by the OS to free RAM
- The connection fails
- User re-opens the app
Version
10.7.0
What SDK flavour are you using?
MongoDB Realm (i.e. Sync, auth, functions)
What type of application is this?
Xamarin
Client OS and version
Android (tested on 12, 11, 10, 9 and 8), iOS (tested on 15)
Code snippets
No response
Stacktrace of the exception/crash you're getting
This is the stack trace of the main thread when I pause the app. Realms.Native.HttpClientTransport.ExecuteRequest() in /Users/luccasclezar/Library/Caches/VisualStudio/8.0/Symbols/realm/realm-dotnet/ead7c424c900108b1f47b5bbe33f6972d0461966/Realm/Realm/Native/HttpClientTransport.cs:125 System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start<Realms.Native.HttpClientTransport.<ExecuteRequest>d__9>(Realms.Native.HttpClientTransport stateMachine) in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:84 Realms.Native.HttpClientTransport.ExecuteRequest(Realms.Native.HttpClientTransport.HttpClientRequest request, System.IntPtr callback) in Realms.Native.HttpClientTransport.respond() in Realms.Native.HttpClientTransport.ExecuteRequest() in D:/a/realm-dotnet/realm-dotnet/Realm/Realm/Native/HttpClientTransport.cs:185 System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(object stateMachine) in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1092 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:968 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:910 System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1073 System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation.<>c.<.cctor>b__7_0(object state) in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskContinuation.cs:379 Foundation.NSAsyncSynchronizationContextDispatcher.Apply() in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSAction.cs:178 UIKit.UIApplication.UIApplicationMain() in UIKit.UIApplication.Main(string[] args, string principalClassName, string delegateClassName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:69 testapp.iOS.Application.Main(string[] args) in /Users/luccasclezar/Projects/testapp/testapp.iOS/Main.cs:17
Relevant log output
No response
- is caused by
-
RCORE-472 Better handle retries when refreshing Sync Session access token
- Closed