realm / realm-core

Core database component for the Realm Mobile Database SDKs
https://realm.io
Apache License 2.0
1k stars 152 forks source link

Session restart with expired refresh token crashes on subsequent login attempt #7190

Open takameyer opened 7 months ago

takameyer commented 7 months ago

Expected results

After a refresh token expires, it should be possible to login again without a crash. Expected result would be to get a new auth session and not crash.

Actual Results

When starting an application with an expired refresh token, attempts to login again crash the application.

Steps & Code to Reproduce

My current setup is to run a local BaaS with the refresh token expiration set to 1 minute. Upon expiration, the sync session is paused and resumed (or the application can be restarted). This results in logging out the user. Upon logging in again, the following crash occurs:

libc++abi: terminating due to uncaught exception of type realm::MultipleSyncAgents: Multiple sync agents attempted to join the same session

Notes

When the refresh token is expired and a manual logout is performed by the application, the crash does not occur. It would seem that the sync session detecting the refresh token expiration leaves it in a state that causes the crash.

Core version

Core version: 13.24.0

takameyer commented 6 months ago

Steps to cause this:

sync-by-unito[bot] commented 6 months ago

➤ On 2023-12-11, michael-wb commented:

From [~andrew.meyer@mongodb.com]:

Was doing a bit more digging into the refresh token issue with Kræn today. Our conclusion is that the session_wrapper never gets added to the list of abandoned_session_wrappers, thus never being fully released. I had some break points setup and wrote down which ones were hit when doing a normal Logout vs refreshing with an expired token. Normal Logout (https://mongodb.slack.com/archives/D067Z3BV0NM/p1701887707219769)

SyncUser::log_out
SyncSession::force_close()
Session::abandon();
ClientImpl::register_abandoned_session_wrapper
SyncManager::unregister_session()
Realm_close();
~ExternalReference
SyncManager::unregister_session()
actualize_and_finalize_session_wrappers()
DB::release_sync_agent()

Refresh with expired token: [^multiple-sync-agents-crash.txt]

handle_bad_auth
SyncUser::log_out
SyncSession::force_close()
SyncManager::unregister_session()
Realm_close()
~ExternalReference
SyncManager::unregister_session()

One again, a bit unsure how to move forward.

The Realm_close() is happening from the JS thread when the RealmProvider is unmounted.

sync-by-unito[bot] commented 6 months ago

➤ michael-wb commented:

I believe this is due to the threading model (based on a single thread) in the JS SDK, where the event loop in the Realm is not getting a chance to run and the Realm is stuck in the garbage collector instead of properly being unregistered and torn down.

sync-by-unito[bot] commented 5 months ago

➤ michael-wb commented:

Working with team to track down the threading issue in JS - the realm being closed is getting destroyed, but is stuck on the garbage collector since the event loop didn't get a chance to run to close out the realm.

Navil commented 1 month ago

Any updates on this? I am seeing my production app crashing due to this.

michael-wb commented 1 month ago

Hi @Navil - unfortunately we don't have any updates on this at this time, but we will start looking at this again to see if we can reproduce it and come up with a solution. You wouldn't happen to have a demo app to reproduce or a log of some sort from your app that could help with tracking this down?

Navil commented 1 month ago

I sadly can't reproduce it myself. It also never happened to me. I checked my production sentry now and these are crashes I found that look to be caused by Realm. Does any of those look related to this? If yes, I could check the logs at least and see what could have happened.

image

image

image

image

All of those "abort" crashes happen directly after the user logged in and synced the mandatory data (I first sync some mandatory stuff and wait for it to finish and then load all the "optional" things)

P.S. I just created a ticket in realm-dart too, because I honestly forgot about this one here. (https://github.com/realm/realm-dart/issues/1708)

nielsenko commented 3 weeks ago

@michael-wb We have found a way to reproduce this crash (or at least a similar one) on Android.

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/sdk_gphone64_arm64/emu64a:14/UE1A.230829.036/11036701:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2024-06-14 17:48:31.113956099+0200
Process uptime: 1362s
Cmdline: com.example.issue1708
pid: 4337, tid: 5230, name: 2.ui  >>> com.example.issue1708 <<<
uid: 10190
tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY)
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
Abort message: 'terminating due to uncaught exception of type realm::MultipleSyncAgents: Multiple sync agents attempted to join the same session'
    x0  0000000000000000  x1  000000000000146e  x2  0000000000000006  x3  0000007110a7ad80
    x4  646277641f736766  x5  646277641f736766  x6  646277641f736766  x7  7f7f7f7f7f7f7f7f
    x8  00000000000000f0  x9  000000742a47c090  x10 0000000000000001  x11 000000742a4cf058
    x12 00000000666c664f  x13 000000007fffffff  x14 00000000009eb236  x15 00000ea8b5e08bcc
    x16 000000742a53cd08  x17 000000742a510e90  x18 0000006ff86c0000  x19 00000000000010f1
    x20 000000000000146e  x21 00000000ffffffff  x22 0000007110a7aeb0  x23 0000007110a7aef0
    x24 0000007110a7afa0  x25 0000007110a7bcb0  x26 0000007110a7bff8  x27 00000000000fc000
    x28 00000000000fe000  x29 0000007110a7ae00
    lr  000000742a4c09b8  sp  0000007110a7ad60  pc  000000742a4c09e4  pst 0000000000001000
29 total frames
backtrace:
      #00 pc 00000000000669e4  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: a87908b48b368e6282bcc9f34bcfc28c)
      #01 pc 00000000014b1d84  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #02 pc 00000000014b1678  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #03 pc 00000000014b1534  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #04 pc 00000000014ca854  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #05 pc 00000000014ca7c8  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (__cxa_throw+128) (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #06 pc 0000000000efaf24  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #07 pc 0000000000c03d4c  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #08 pc 0000000000c0368c  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #09 pc 0000000000c39d0c  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #10 pc 0000000000c39b7c  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #11 pc 000000000082d9bc  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #12 pc 0000000000c0faec  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #13 pc 0000000000c0f964  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #14 pc 000000000082d9bc  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #15 pc 0000000000c39f6c  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #16 pc 0000000000c39e9c  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #17 pc 000000000082d9bc  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #18 pc 0000000000d283cc  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #19 pc 0000000000d4cba0  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #20 pc 0000000000d4c860  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #21 pc 0000000000d49824  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #22 pc 0000000000d497fc  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #23 pc 0000000000d27764  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #24 pc 0000000000d2ab2c  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #25 pc 0000000000d2aab0  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #26 pc 0000000000d2a838  /data/app/~~2JAeeUbdcwIhwAsjOa0iHg==/com.example.issue1708-qNG5baQUWOUn2RK4jcaUJQ==/lib/arm64/librealm_dart.so (BuildId: a8f10c6a888a41410e3469d4648a5ce794440b8d)
      #27 pc 00000000000cb6a8  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: a87908b48b368e6282bcc9f34bcfc28c)
      #28 pc 000000000006821c  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: a87908b48b368e6282bcc9f34bcfc28c)
Lost connection to device.

Exited.

And here in a symbolicated version:

abort_message   abort_message.cpp:0:0
demangling_terminate_handler()  cxa_default_handlers.cpp:0:0
std::__terminate(void (*)())    cxa_handlers.cpp:0:0
__cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*)  cxa_exception.cpp:0:0
__cxa_throw ??:0:0
realm::DB::claim_sync_agent()   realm/db.cpp:2866:9
realm::sync::SessionWrapper::actualize()    realm/sync/client.cpp:1515:11
realm::sync::ClientImpl::actualize_and_finalize_session_wrappers()  realm/sync/client.cpp:566:22
realm::sync::ClientImpl::ClientImpl(realm::sync::ClientConfig)::$_0::operator()(realm::Status) const    realm/sync/noinst/client_impl_base.cpp:229:9
realm::util::UniqueFunction<void (realm::Status)>::SpecificImpl<realm::sync::ClientImpl::ClientImpl(realm::sync::ClientConfig)::$_0>::call(realm::Status&&) realm/util/functional.hpp:154:17
realm::util::UniqueFunction<void (realm::Status)>::operator()(realm::Status) const  realm/util/functional.hpp:94:22
realm::sync::Trigger<realm::sync::ClientImpl>::trigger()::'lambda'(realm::Status)::operator()(realm::Status) const  realm/sync/trigger.hpp:138:9
realm::util::UniqueFunction<void (realm::Status)>::SpecificImpl<realm::sync::Trigger<realm::sync::ClientImpl>::trigger()::'lambda'(realm::Status)>::call(realm::Status&&)   realm/util/functional.hpp:154:17
realm::util::UniqueFunction<void (realm::Status)>::operator()(realm::Status) const  realm/util/functional.hpp:94:22
realm::sync::ClientImpl::post(realm::util::UniqueFunction<void (realm::Status)>&&)::$_0::operator()(realm::Status) const    realm/sync/noinst/client_impl_base.cpp:259:9
realm::util::UniqueFunction<void (realm::Status)>::SpecificImpl<realm::sync::ClientImpl::post(realm::util::UniqueFunction<void (realm::Status)>&&)::$_0>::call(realm::Status&&) realm/util/functional.hpp:154:17
realm::util::UniqueFunction<void (realm::Status)>::operator()(realm::Status) const  realm/util/functional.hpp:94:22
realm::sync::network::Service::PostOper<realm::util::UniqueFunction<void (realm::Status)>>::recycle_and_execute()   realm/sync/network/network.hpp:2017:9
realm::sync::network::Service::Impl::execute(std::__ndk1::unique_ptr<realm::sync::network::Service::AsyncOper, realm::sync::network::Service::LendersOperDeleter>&) realm/sync/network/network.cpp:1646:32
realm::sync::network::Service::Impl::run_impl(bool) realm/sync/network/network.cpp:1574:13
realm::sync::network::Service::Impl::run_until_stopped()    realm/sync/network/network.cpp:1385:9
realm::sync::network::Service::run_until_stopped()  realm/sync/network/network.cpp:1776:13
realm::sync::websocket::DefaultSocketProvider::event_loop() realm/sync/network/default_socket.cpp:599:19
decltype(*std::declval<realm::sync::websocket::DefaultSocketProvider*>().*std::declval<void (realm::sync::websocket::DefaultSocketProvider::*)()>()()) std::__ndk1::__invoke[abi:v170000]<void (realm::sync::websocket::DefaultSocketProvider::*)(), realm::sync::websocket::DefaultSocketProvider*, void>(void (realm::sync::websocket::DefaultSocketProvider::*&&)(), realm::sync::websocket::DefaultSocketProvider*&&)   /Users/kasper/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/__functional/invoke.h:359:23
void std::__ndk1::__thread_execute[abi:v170000]<std::__ndk1::unique_ptr<std::__ndk1::__thread_struct, std::__ndk1::default_delete<std::__ndk1::__thread_struct>>, void (realm::sync::websocket::DefaultSocketProvider::*)(), realm::sync::websocket::DefaultSocketProvider*, 2ul>(std::__ndk1::tuple<std::__ndk1::unique_ptr<std::__ndk1::__thread_struct, std::__ndk1::default_delete<std::__ndk1::__thread_struct>>, void (realm::sync::websocket::DefaultSocketProvider::*)(), realm::sync::websocket::DefaultSocketProvider*>&, std::__ndk1::__tuple_indices<2ul>)  /Users/kasper/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/thread:282:5
void* std::__ndk1::__thread_proxy[abi:v170000]<std::__ndk1::tuple<std::__ndk1::unique_ptr<std::__ndk1::__thread_struct, std::__ndk1::default_delete<std::__ndk1::__thread_struct>>, void (realm::sync::websocket::DefaultSocketProvider::*)(), realm::sync::websocket::DefaultSocketProvider*>>(void*)  /Users/kasper/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/thread:293:5

and here the full log leading up to the crash (at log level detail for the top level catogory):

Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
PathDependency: path@../../realm-dart/packages/realm
PathDependency: path@../../realm-dart/packages/realm
Path dependency for realm found. Skipping install of native lib (assuming local development)
✓ Built build/app/outputs/flutter-apk/app-debug.apk
Connecting to VM Service at ws://127.0.0.1:60124/j3AQmQP60BM=/ws
Connected to the VM Service.
I/flutter ( 4337): pid: 4337
I/flutter ( 4337): Isolate.current.hashCode: 227663847
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 32681 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 32681 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 32681 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 32681 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 32681 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 32681 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 32681 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 32681 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 32681 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/666ad949af797a278ec3cc8a/default.realm)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Realm sync client ([realm-core-14.10.0]))
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Platform: Android Linux 6.1.23-android14-4-00257-g7e35917775b8-ab9964412 #1 SMP PREEMPT Mon Apr 17 20:50:58 UTC 2023 aarch64)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Session[1]: Binding '/data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/666ad949af797a278ec3cc8a/default.realm' to '')
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Session[1]: client_reset_config = false, Realm exists = true )
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Connecting to 'wss://ws.services.cloud.mongodb.com:443/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Resolving 'ws.services.cloud.mongodb.com:443')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Connecting to endpoint '35.158.24.208:443' (1/3))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.info, message: Connected to endpoint '35.158.24.208:443' (from '10.0.2.15:46536'))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.error, message: Websocket: Expected HTTP response 101 Switching Protocols, but received:
I/flutter ( 4337): HTTP/1.1 308 Permanent Redirect
I/flutter ( 4337): cache-control: no-cache, no-store, must-revalidate
I/flutter ( 4337): connection: close
I/flutter ( 4337): content-length: 0
I/flutter ( 4337): date: Fri, 14 Jun 2024 15:25:54 GMT
I/flutter ( 4337): location: https://us-east-1.aws.services.cloud.mongodb.com/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync
I/flutter ( 4337): server: mdbws
I/flutter ( 4337): strict-transport-security: max-age=31536000; includeSubdomains;
I/flutter ( 4337): vary: Origin
I/flutter ( 4337): x-appservices-request-id: 666c61021e853fa5cab29dda
I/flutter ( 4337): x-frame-options: DENY
I/flutter ( 4337): x-xgen-up-proto: HTTP/1.1
I/flutter ( 4337):
I/flutter ( 4337): )
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Closing the websocket with error code=WebSocket: Moved Permanently, message='Bad WebSocket response 308 permanent redirect', was_clean=true)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.detail, message: Connection[1] Allowing reconnection in 896 milliseconds)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Connecting to 'wss://ws.services.cloud.mongodb.com:443/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Resolving 'ws.services.cloud.mongodb.com:443')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Connecting to endpoint '35.158.24.208:443' (1/3))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.info, message: Connected to endpoint '35.158.24.208:443' (from '10.0.2.15:46538'))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.error, message: Websocket: Expected HTTP response 101 Switching Protocols, but received:
I/flutter ( 4337): HTTP/1.1 308 Permanent Redirect
I/flutter ( 4337): cache-control: no-cache, no-store, must-revalidate
I/flutter ( 4337): connection: close
I/flutter ( 4337): content-length: 0
I/flutter ( 4337): date: Fri, 14 Jun 2024 15:25:55 GMT
I/flutter ( 4337): location: https://us-east-1.aws.services.cloud.mongodb.com/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync
I/flutter ( 4337): server: mdbws
I/flutter ( 4337): strict-transport-security: max-age=31536000; includeSubdomains;
I/flutter ( 4337): vary: Origin
I/flutter ( 4337): x-appservices-request-id: 666c6103111f3215e55ee85e
I/flutter ( 4337): x-frame-options: DENY
I/flutter ( 4337): x-xgen-up-proto: HTTP/1.1
I/flutter ( 4337):
I/flutter ( 4337): )
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Closing the websocket with error code=WebSocket: Moved Permanently, message='Bad WebSocket response 308 permanent redirect', was_clean=true)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.detail, message: Connection[1] Allowing reconnection in 1739 milliseconds)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 34947 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 34947 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 34947 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 34947 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 35359 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 35359 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 35359 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 35359 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Connecting to 'wss://ws.services.cloud.mongodb.com:443/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Resolving 'ws.services.cloud.mongodb.com:443')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Connecting to endpoint '35.158.24.208:443' (1/3))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.info, message: Connected to endpoint '35.158.24.208:443' (from '10.0.2.15:46546'))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.error, message: Websocket: Expected HTTP response 101 Switching Protocols, but received:
I/flutter ( 4337): HTTP/1.1 308 Permanent Redirect
I/flutter ( 4337): cache-control: no-cache, no-store, must-revalidate
I/flutter ( 4337): connection: close
I/flutter ( 4337): content-length: 0
I/flutter ( 4337): date: Fri, 14 Jun 2024 15:25:57 GMT
I/flutter ( 4337): location: https://us-east-1.aws.services.cloud.mongodb.com/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync
I/flutter ( 4337): server: mdbws
I/flutter ( 4337): strict-transport-security: max-age=31536000; includeSubdomains;
I/flutter ( 4337): vary: Origin
I/flutter ( 4337): x-appservices-request-id: 666c6105fe0762ac05550b61
I/flutter ( 4337): x-frame-options: DENY
I/flutter ( 4337): x-xgen-up-proto: HTTP/1.1
I/flutter ( 4337):
I/flutter ( 4337): )
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Closing the websocket with error code=WebSocket: Moved Permanently, message='Bad WebSocket response 308 permanent redirect', was_clean=true)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.detail, message: Connection[1] Allowing reconnection in 3183 milliseconds)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 40715 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 40715 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 40715 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 40715 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Connecting to 'wss://ws.services.cloud.mongodb.com:443/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Resolving 'ws.services.cloud.mongodb.com:443')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Connecting to endpoint '35.158.24.208:443' (1/3))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.info, message: Connected to endpoint '35.158.24.208:443' (from '10.0.2.15:46554'))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.error, message: Websocket: Expected HTTP response 101 Switching Protocols, but received:
I/flutter ( 4337): HTTP/1.1 308 Permanent Redirect
I/flutter ( 4337): cache-control: no-cache, no-store, must-revalidate
I/flutter ( 4337): connection: close
I/flutter ( 4337): content-length: 0
I/flutter ( 4337): date: Fri, 14 Jun 2024 15:26:01 GMT
I/flutter ( 4337): location: https://us-east-1.aws.services.cloud.mongodb.com/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync
I/flutter ( 4337): server: mdbws
I/flutter ( 4337): strict-transport-security: max-age=31536000; includeSubdomains;
I/flutter ( 4337): vary: Origin
I/flutter ( 4337): x-appservices-request-id: 666c61091e853fa5cab2a706
I/flutter ( 4337): x-frame-options: DENY
I/flutter ( 4337): x-xgen-up-proto: HTTP/1.1
I/flutter ( 4337):
I/flutter ( 4337): )
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Closing the websocket with error code=WebSocket: Moved Permanently, message='Bad WebSocket response 308 permanent redirect', was_clean=true)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.detail, message: Connection[1] Allowing reconnection in 7232 milliseconds)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 41745 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 41745 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 41745 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 41745 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Connecting to 'wss://ws.services.cloud.mongodb.com:443/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Resolving 'ws.services.cloud.mongodb.com:443')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Connecting to endpoint '35.158.24.208:443' (1/3))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.info, message: Connected to endpoint '35.158.24.208:443' (from '10.0.2.15:44604'))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.error, message: Websocket: Expected HTTP response 101 Switching Protocols, but received:
I/flutter ( 4337): HTTP/1.1 308 Permanent Redirect
I/flutter ( 4337): cache-control: no-cache, no-store, must-revalidate
I/flutter ( 4337): connection: close
I/flutter ( 4337): content-length: 0
I/flutter ( 4337): date: Fri, 14 Jun 2024 15:26:08 GMT
I/flutter ( 4337): location: https://us-east-1.aws.services.cloud.mongodb.com/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync
I/flutter ( 4337): server: mdbws
I/flutter ( 4337): strict-transport-security: max-age=31536000; includeSubdomains;
I/flutter ( 4337): vary: Origin
I/flutter ( 4337): x-appservices-request-id: 666c61102c9e81364bd68708
I/flutter ( 4337): x-frame-options: DENY
I/flutter ( 4337): x-xgen-up-proto: HTTP/1.1
I/flutter ( 4337):
I/flutter ( 4337): )
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Closing the websocket with error code=WebSocket: Moved Permanently, message='Bad WebSocket response 308 permanent redirect', was_clean=true)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.detail, message: Connection[1] Allowing reconnection in 13350 milliseconds)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 44835 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 44835 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 44835 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 44835 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Connecting to 'wss://ws.services.cloud.mongodb.com:443/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Resolving 'ws.services.cloud.mongodb.com:443')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Connecting to endpoint '35.158.24.208:443' (1/3))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.info, message: Connected to endpoint '35.158.24.208:443' (from '10.0.2.15:54480'))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.error, message: Websocket: Expected HTTP response 101 Switching Protocols, but received:
I/flutter ( 4337): HTTP/1.1 308 Permanent Redirect
I/flutter ( 4337): cache-control: no-cache, no-store, must-revalidate
I/flutter ( 4337): connection: close
I/flutter ( 4337): content-length: 0
I/flutter ( 4337): date: Fri, 14 Jun 2024 15:26:22 GMT
I/flutter ( 4337): location: https://us-east-1.aws.services.cloud.mongodb.com/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync
I/flutter ( 4337): server: mdbws
I/flutter ( 4337): strict-transport-security: max-age=31536000; includeSubdomains;
I/flutter ( 4337): vary: Origin
I/flutter ( 4337): x-appservices-request-id: 666c611e111f3215e55f03e1
I/flutter ( 4337): x-frame-options: DENY
I/flutter ( 4337): x-xgen-up-proto: HTTP/1.1
I/flutter ( 4337):
I/flutter ( 4337): )
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Closing the websocket with error code=WebSocket: Moved Permanently, message='Bad WebSocket response 308 permanent redirect', was_clean=true)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.detail, message: Connection[1] Allowing reconnection in 24417 milliseconds)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38758 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38758 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38758 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38758 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Connecting to 'wss://ws.services.cloud.mongodb.com:443/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Resolving 'ws.services.cloud.mongodb.com:443')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Connecting to endpoint '35.158.24.208:443' (1/3))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.info, message: Connected to endpoint '35.158.24.208:443' (from '10.0.2.15:58958'))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.error, message: Websocket: Expected HTTP response 101 Switching Protocols, but received:
I/flutter ( 4337): HTTP/1.1 308 Permanent Redirect
I/flutter ( 4337): cache-control: no-cache, no-store, must-revalidate
I/flutter ( 4337): connection: close
I/flutter ( 4337): content-length: 0
I/flutter ( 4337): date: Fri, 14 Jun 2024 15:26:46 GMT
I/flutter ( 4337): location: https://us-east-1.aws.services.cloud.mongodb.com/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync
I/flutter ( 4337): server: mdbws
I/flutter ( 4337): strict-transport-security: max-age=31536000; includeSubdomains;
I/flutter ( 4337): vary: Origin
I/flutter ( 4337): x-appservices-request-id: 666c61361e853fa5cab2fa00
I/flutter ( 4337): x-frame-options: DENY
I/flutter ( 4337): x-xgen-up-proto: HTTP/1.1
I/flutter ( 4337):
I/flutter ( 4337): )
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Closing the websocket with error code=WebSocket: Moved Permanently, message='Bad WebSocket response 308 permanent redirect', was_clean=true)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.detail, message: Connection[1] Allowing reconnection in 53038 milliseconds)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38655 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38655 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38655 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38655 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Connecting to 'wss://ws.services.cloud.mongodb.com:443/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Resolving 'ws.services.cloud.mongodb.com:443')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Connecting to endpoint '18.153.201.179:443' (1/3))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.info, message: Connected to endpoint '18.153.201.179:443' (from '10.0.2.15:41984'))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.error, message: Websocket: Expected HTTP response 101 Switching Protocols, but received:
I/flutter ( 4337): HTTP/1.1 308 Permanent Redirect
I/flutter ( 4337): cache-control: no-cache, no-store, must-revalidate
I/flutter ( 4337): connection: close
I/flutter ( 4337): content-length: 0
I/flutter ( 4337): date: Fri, 14 Jun 2024 15:27:40 GMT
I/flutter ( 4337): location: https://us-east-1.aws.services.cloud.mongodb.com/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync
I/flutter ( 4337): server: mdbws
I/flutter ( 4337): strict-transport-security: max-age=31536000; includeSubdomains;
I/flutter ( 4337): vary: Origin
I/flutter ( 4337): x-appservices-request-id: 666c616cf378c2503dc91557
I/flutter ( 4337): x-frame-options: DENY
I/flutter ( 4337): x-xgen-up-proto: HTTP/1.1
I/flutter ( 4337):
I/flutter ( 4337): )
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Closing the websocket with error code=WebSocket: Moved Permanently, message='Bad WebSocket response 308 permanent redirect', was_clean=true)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.detail, message: Connection[1] Allowing reconnection in 110697 milliseconds)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 36183 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 36183 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 36183 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 36183 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Connecting to 'wss://ws.services.cloud.mongodb.com:443/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Resolving 'ws.services.cloud.mongodb.com:443')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Connecting to endpoint '35.158.24.208:443' (1/3))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.info, message: Connected to endpoint '35.158.24.208:443' (from '10.0.2.15:52822'))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.error, message: Websocket: Expected HTTP response 101 Switching Protocols, but received:
I/flutter ( 4337): HTTP/1.1 308 Permanent Redirect
I/flutter ( 4337): cache-control: no-cache, no-store, must-revalidate
I/flutter ( 4337): connection: close
I/flutter ( 4337): content-length: 0
I/flutter ( 4337): date: Fri, 14 Jun 2024 15:29:31 GMT
I/flutter ( 4337): location: https://us-east-1.aws.services.cloud.mongodb.com/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync
I/flutter ( 4337): server: mdbws
I/flutter ( 4337): strict-transport-security: max-age=31536000; includeSubdomains;
I/flutter ( 4337): vary: Origin
I/flutter ( 4337): x-appservices-request-id: 666c61dbbddcbd331eeda64c
I/flutter ( 4337): x-frame-options: DENY
I/flutter ( 4337): x-xgen-up-proto: HTTP/1.1
I/flutter ( 4337):
I/flutter ( 4337): )
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Closing the websocket with error code=WebSocket: Moved Permanently, message='Bad WebSocket response 308 permanent redirect', was_clean=true)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.detail, message: Connection[1] Allowing reconnection in 254431 milliseconds)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38758 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38758 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38758 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38758 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Connecting to 'wss://ws.services.cloud.mongodb.com:443/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Resolving 'ws.services.cloud.mongodb.com:443')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Connecting to endpoint '18.153.201.179:443' (1/3))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.info, message: Connected to endpoint '18.153.201.179:443' (from '10.0.2.15:51478'))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.error, message: Websocket: Expected HTTP response 101 Switching Protocols, but received:
I/flutter ( 4337): HTTP/1.1 308 Permanent Redirect
I/flutter ( 4337): cache-control: no-cache, no-store, must-revalidate
I/flutter ( 4337): connection: close
I/flutter ( 4337): content-length: 0
I/flutter ( 4337): date: Fri, 14 Jun 2024 15:33:46 GMT
I/flutter ( 4337): location: https://us-east-1.aws.services.cloud.mongodb.com/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync
I/flutter ( 4337): server: mdbws
I/flutter ( 4337): strict-transport-security: max-age=31536000; includeSubdomains;
I/flutter ( 4337): vary: Origin
I/flutter ( 4337): x-appservices-request-id: 666c62da315be2668f9bfab5
I/flutter ( 4337): x-frame-options: DENY
I/flutter ( 4337): x-xgen-up-proto: HTTP/1.1
I/flutter ( 4337):
I/flutter ( 4337): )
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Closing the websocket with error code=WebSocket: Moved Permanently, message='Bad WebSocket response 308 permanent redirect', was_clean=true)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.detail, message: Connection[1] Allowing reconnection in 288900 milliseconds)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38655 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38655 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38655 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38655 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Connecting to 'wss://ws.services.cloud.mongodb.com:443/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Resolving 'ws.services.cloud.mongodb.com:443')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Connecting to endpoint '35.158.24.208:443' (1/3))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.info, message: Connected to endpoint '35.158.24.208:443' (from '10.0.2.15:42908'))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.error, message: Websocket: Expected HTTP response 101 Switching Protocols, but received:
I/flutter ( 4337): HTTP/1.1 308 Permanent Redirect
I/flutter ( 4337): cache-control: no-cache, no-store, must-revalidate
I/flutter ( 4337): connection: close
I/flutter ( 4337): content-length: 0
I/flutter ( 4337): date: Fri, 14 Jun 2024 15:38:35 GMT
I/flutter ( 4337): location: https://us-east-1.aws.services.cloud.mongodb.com/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync
I/flutter ( 4337): server: mdbws
I/flutter ( 4337): strict-transport-security: max-age=31536000; includeSubdomains;
I/flutter ( 4337): vary: Origin
I/flutter ( 4337): x-appservices-request-id: 666c63fb9cf1e935b455f304
I/flutter ( 4337): x-frame-options: DENY
I/flutter ( 4337): x-xgen-up-proto: HTTP/1.1
I/flutter ( 4337):
I/flutter ( 4337): )
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Closing the websocket with error code=WebSocket: Moved Permanently, message='Bad WebSocket response 308 permanent redirect', was_clean=true)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.detail, message: Connection[1] Allowing reconnection in 277419 milliseconds)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38243 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38243 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38243 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 38243 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Connecting to 'wss://ws.services.cloud.mongodb.com:443/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Resolving 'ws.services.cloud.mongodb.com:443')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Connecting to endpoint '3.123.99.155:443' (1/3))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.info, message: Connected to endpoint '3.123.99.155:443' (from '10.0.2.15:56932'))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.error, message: Websocket: Expected HTTP response 101 Switching Protocols, but received:
I/flutter ( 4337): HTTP/1.1 308 Permanent Redirect
I/flutter ( 4337): cache-control: no-cache, no-store, must-revalidate
I/flutter ( 4337): connection: close
I/flutter ( 4337): content-length: 0
I/flutter ( 4337): date: Fri, 14 Jun 2024 15:43:13 GMT
I/flutter ( 4337): location: https://us-east-1.aws.services.cloud.mongodb.com/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync
I/flutter ( 4337): server: mdbws
I/flutter ( 4337): strict-transport-security: max-age=31536000; includeSubdomains;
I/flutter ( 4337): vary: Origin
I/flutter ( 4337): x-appservices-request-id: 666c6511fe0762ac05688bb3
I/flutter ( 4337): x-frame-options: DENY
I/flutter ( 4337): x-xgen-up-proto: HTTP/1.1
I/flutter ( 4337):
I/flutter ( 4337): )
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Closing the websocket with error code=WebSocket: Moved Permanently, message='Bad WebSocket response 308 permanent redirect', was_clean=true)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.detail, message: Connection[1] Allowing reconnection in 274554 milliseconds)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 40715 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 40715 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 40715 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 40715 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Connecting to 'wss://ws.services.cloud.mongodb.com:443/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Resolving 'ws.services.cloud.mongodb.com:443')
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.detail, message: Connecting to endpoint '18.153.201.179:443' (1/3))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.info, message: Connected to endpoint '18.153.201.179:443' (from '10.0.2.15:55180'))
I/flutter ( 4337): (category: Realm.Sync.Client.Network, level: LogLevel.error, message: Websocket: Expected HTTP response 101 Switching Protocols, but received:
I/flutter ( 4337): HTTP/1.1 308 Permanent Redirect
I/flutter ( 4337): cache-control: no-cache, no-store, must-revalidate
I/flutter ( 4337): connection: close
I/flutter ( 4337): content-length: 0
I/flutter ( 4337): date: Fri, 14 Jun 2024 15:47:48 GMT
I/flutter ( 4337): location: https://us-east-1.aws.services.cloud.mongodb.com/api/client/v2.0/app/issue1708-app-qrczrkb/realm-sync
I/flutter ( 4337): server: mdbws
I/flutter ( 4337): strict-transport-security: max-age=31536000; includeSubdomains;
I/flutter ( 4337): vary: Origin
I/flutter ( 4337): x-appservices-request-id: 666c66244fcec793fa88f852
I/flutter ( 4337): x-frame-options: DENY
I/flutter ( 4337): x-xgen-up-proto: HTTP/1.1
I/flutter ( 4337):
I/flutter ( 4337): )
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.info, message: Connection[1] Closing the websocket with error code=WebSocket: Moved Permanently, message='Bad WebSocket response 308 permanent redirect', was_clean=true)
I/flutter ( 4337): (category: Realm.Sync.Client.Session, level: LogLevel.detail, message: Connection[1] Allowing reconnection in 297086 milliseconds)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 39376 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 39376 Thread 485577133232: DB closed)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 39376 Thread 485577133232: Open file: /data/data/com.example.issue1708/files/mongodb-realm/issue1708-app-qrczrkb/server-utility/metadata/sync_metadata.realm)
I/flutter ( 4337): (category: Realm.Storage, level: LogLevel.detail, message: DB: 39376 Thread 485577133232: DB closed)
D/EGL_emulation( 4337): app_time_stats: avg=450815.59ms min=7.01ms max=1351858.88ms count=3
W/WindowOnBackDispatcher( 4337): sendCancelIfRunning: isInProgress=falsecallback=android.view.ViewRootImpl$$ExternalSyntheticLambda17@d035b4c
W/OpenGLRenderer( 4337): Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
W/OpenGLRenderer( 4337): Failed to initialize 101010-2 format, error = EGL_SUCCESS
E/OpenGLRenderer( 4337): Unable to match the desired swap behavior.
I/flutter ( 4337): pid: 4337
I/flutter ( 4337): Isolate.current.hashCode: 980993883
E/libc++abi( 4337): terminating due to uncaught exception of type realm::MultipleSyncAgents: Multiple sync agents attempted to join the same session
F/libc    ( 4337): Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 5230 (2.ui), pid 4337 (ample.issue1708)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
nielsenko commented 3 weeks ago

Reproduced with:

// ignore_for_file: avoid_print

import 'dart:io';
import 'dart:isolate';

import 'package:flutter/material.dart';
import 'package:realm/realm.dart';

part 'main.realm.dart';

@RealmModel()
class _Person {
  @PrimaryKey()
  @MapTo('_id')
  late ObjectId id;

  late String name;
  late int age;
}

const appId = String.fromEnvironment('APP_ID');

final realmInit = () async {
  final app = App(AppConfiguration(appId));
  final user = app.currentUser ?? await app.logIn(Credentials.anonymous());
  return Realm(Configuration.flexibleSync(user, [Person.schema]));
}();

void main() async {
  // Runs this on an Andoid amulator
  Realm.logger.setLogLevel(LogLevel.detail);
  Realm.logger.onRecord.listen(print);

  // Trace pid and isolate. Note that pid stays the same, but isolate changes,
  // when putting the app in background and then foreground again.
  print('pid: $pid');
  print('Isolate.current.hashCode: ${Isolate.current.hashCode}');

  // On re-entry the app crashes with:
  //
  // signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
  // Abort message: 'terminating due to uncaught exception of type realm::MultipleSyncAgents: Multiple sync agents attempted to join the same session'

  runApp(const Placeholder());
  final realm = await realmInit;
  realm.close(); // close explicitly - without this we don't crash
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({
    super.key,
  });

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool _isPressed = false;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        // Just to show that the activity is torn down
        backgroundColor: _isPressed ? Colors.red : Colors.green,
        floatingActionButton: TextButton(
          onPressed: () => setState(() => _isPressed = !_isPressed),
          child: const Text('Press me!'),
        ),
      ),
    );
  }
}
michael-wb commented 3 weeks ago

Nice! Thank you @nielsenko - do you have any stack traces for the other threads that are running in the system. This exception is coming from the fact that there is still another Realm that is currently open and it would be nice if we can see where the other Realm may still be in use and hasn't been deleted yet.

Also, what is the scenario that cause it to happen? I'll see if I can infer it from the log you provided, but additional context might help. Ah, the code was just added - I'll take a look.

nielsenko commented 3 weeks ago

Unfortunately I don't have the other stacks. This happens on the android emulator, and I'm not sure how to get those thread stacks.

I added the full program that repro this, but basically it happens when you press back to leave the app and then return to the app. The process is not torn down, but the android activity is, and hence the isolate in dart is torn down and recreated.. basically running main twice in the same process.

This in turn, creates an app again.

If I make sure to close the realm before tearing down the isolate

realm.close(); // close explicitly - without this we don't crash

then I crash when main is run again.