Igalia / wolvic

A fast and secure browser for standalone virtual-reality and augmented-reality headsets.
https://wolvic.org
Mozilla Public License 2.0
813 stars 105 forks source link

Not possible to add new items to the Library Panel after signing out from the Firefox Accounts service #1307

Closed javifernandez closed 8 months ago

javifernandez commented 8 months ago

Configuration

Wolvic version: Wolvic 1.6 Wolvic build ID: 308

Hardware: Quest 2

Steps to Reproduce

  1. Go to the Firefox Account login page
  2. Login with your account credentials
  3. Check that the synchronization worked
  4. sign out and activate thew checkbox to clearing out the history from the device
  5. Type a new url in the url bar and add it to bookmarks
  6. Try to perform a new login into the Firefox Account service

Current Behavior

The url doesn't appear in the bookmarks panel; it doesn't appear in the History panel either. The new login appears to be successful, but the synchronization never happens.

Expected Behavior

The bookmarks panel should have the new added item and it must be in the History as well. The new synchronization attempt should have been performed just after completing the singing process

Possible Solution

Context

When activating the checkbox to clear our the Library storage on FxA signing out the user expects that the last synced content to be reverted. However, this leads to an inconsistent state in the database that prevents performing any change.

The logs suggest that the sqlite database is wiped out in the process, so any subsequent operation will fail when trying to establish a new connection.

The only way to recover from this state is to restart the application.

Error Logs and Stack Traces

``` 2024-03-13 14:28:34.778 11311-11507 Gecko com.igalia.wolvic.dev I console.error: "account_updates error message. " "No Such Channel" 2024-03-13 14:28:34.778 11311-11507 GeckoConsole com.igalia.wolvic.dev E [JavaScript Error: "account_updates error message. No Such Channel"] 2024-03-13 14:28:34.779 11311-11311 mozac-fxawebchannel com.igalia.wolvic.dev W Unrecognized WebChannel command: fxaccounts:login 2024-03-13 14:28:34.780 11311-11311 mozac-fxawebchannel com.igalia.wolvic.dev E Error while processing WebChannel command org.json.JSONException: Couldn't get WebChannel command at mozilla.components.feature.accounts.FxaWebChannelFeature$WebChannelViewContentMessageHandler.onPortMessage(FxaWebChannelFeature.kt:142) at com.igalia.wolvic.browser.components.GeckoWebExtension$registerContentMessageHandler$portDelegate$1.onPortMessage(GeckoWebExtension.kt:88) at org.mozilla.geckoview.WebExtension$Port.portMessage(WebExtension.java:481) at org.mozilla.geckoview.WebExtension$Port.-$$Nest$mportMessage(Unknown Source:0) at org.mozilla.geckoview.WebExtension$Port$1.handleMessage(WebExtension.java:462) at org.mozilla.gecko.EventDispatcher$3.run(EventDispatcher.java:426) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:214) at android.os.Looper.loop(Looper.java:304) at android.app.ActivityThread.main(ActivityThread.java:7918) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1010) 2024-03-13 14:28:34.792 12541-12561 Web Content com.igalia.wolvic.dev E [JavaScript Error: "WebChannel error: No Such Channel"] 2 ```
svillar commented 8 months ago

Does this fail also on debug builds? I ask just to discard a potential issue with aggressive optimizations by R8

javifernandez commented 8 months ago

Does this fail also on debug builds? I ask just to discard a potential issue with aggressive optimizations by R8

I managed to see that JSON exception in release just now, but finally the sync has been completed successfully, so the cause of the previous failure was not that exception.

javifernandez commented 8 months ago

So the problem seems to be when singing out, and clicking on the checkbox to clear the history of the current device. After that, singing again in the Firefox Accounts service leads to the following logs:

2024-03-13 19:22:46.714  5864-5864  mozac-fxawebchannel     com.igalia.wolvic.metastore          D  Processing WebChannel command: OAUTH_LOGIN
2024-03-13 19:22:46.715  5864-6071  FirefoxAcc...ateMachine com.igalia.wolvic.metastore          I  Processing event 'AuthData(authData=authType: mozilla.components.concept.sync.AuthType$Signin@90340c7, code: XXX, state: XXX, declinedEngines: null)' for state Active(progressState=BeginningAuthentication). Next state is Active(progressState=CompletingAuthentication)
2024-03-13 19:22:46.715  5864-6071  FirefoxAcc...ateMachine com.igalia.wolvic.metastore          I  withRetries: attempt 1/3
2024-03-13 19:22:46.715  5864-5963  FirefoxAccount          com.igalia.wolvic.metastore          I  Executing: complete oauth flow
2024-03-13 19:22:46.716  5864-5963  fxa_client              com.igalia.wolvic.metastore          D  uniffi_fxa_client_fn_method_firefoxaccount_complete_oauth_flow
2024-03-13 19:22:47.002  5864-8072  VrApi                   com.igalia.wolvic.metastore          I  FPS=90/90,Prd=27ms,Tear=1,Early=0,Stale=0,Stale2/5/10/max=0/0/0/0,VSnc=1,Lat=-1,Fov=0,CPU4/GPU=2/1,1171/400MHz,OC=FF,TA=0/0/0,SP=N/N/N,Mem=1555MHz,Free=2458MB,PLS=0,Temp=32.5C/0.0C,TW=3.98ms,App=1.71ms,GD=0.00ms,CPU&GPU=4.37ms,LCnt=7(DR0,LM0),GPU%=0.54,CPU%=0.39(W0.47),DSF=1.00,CFL=12.87/19.49,ICFLp95=16.09,LD=0,SF=1.00,LP=0,DVFS=0
2024-03-13 19:22:47.068  5864-5921  VrRuntimeClient         com.igalia.wolvic.metastore          I  UpdateEvents: HMT was UNmounted
2024-03-13 19:22:47.937  5864-5963  fxa_client              com.igalia.wolvic.metastore          D  uniffi_fxa_client_fn_method_firefoxaccount_to_json
2024-03-13 19:22:47.937  5864-5963  WrappingPe...ceCallback com.igalia.wolvic.metastore          D  Logging state to mozilla.components.service.fxa.StorageWrapper$PersistenceCallback@b0e1892
2024-03-13 19:22:47.942  5864-5963  FxaStatePe...ceCallback com.igalia.wolvic.metastore          D  Persisting account state into mozilla.components.service.fxa.SharedPrefAccountStorage@4431fbd
2024-03-13 19:22:47.942  5864-5963  FirefoxAccount          com.igalia.wolvic.metastore          I  Successfully executed: complete oauth flow
2024-03-13 19:22:47.942  5864-6071  FirefoxAcc...ateMachine com.igalia.wolvic.metastore          I  withRetries: attempt 1/3
2024-03-13 19:22:47.943  5864-5963  fxa_client              com.igalia.wolvic.metastore          D  uniffi_fxa_client_fn_method_firefoxaccount_initialize_device
2024-03-13 19:22:48.002  5864-8072  VrApi                   com.igalia.wolvic.metastore          I  FPS=90/90,Prd=26ms,Tear=0,Early=0,Stale=0,Stale2/5/10/max=0/0/0/0,VSnc=1,Lat=-1,Fov=0,CPU4/GPU=2/1,1171/400MHz,OC=FF,TA=0/0/0,SP=N/N/N,Mem=1555MHz,Free=2458MB,PLS=0,Temp=32.5C/0.0C,TW=3.82ms,App=1.65ms,GD=0.00ms,CPU&GPU=5.03ms,LCnt=5(DR0,LM0),GPU%=0.52,CPU%=0.19(W0.25),DSF=1.00,CFL=12.94/18.80,ICFLp95=15.90,LD=0,SF=1.00,LP=0,DVFS=0
2024-03-13 19:22:48.245  5864-5963  fxa_client              com.igalia.wolvic.metastore          D  uniffi_fxa_client_fn_method_firefoxaccount_to_json
2024-03-13 19:22:48.245  5864-5963  WrappingPe...ceCallback com.igalia.wolvic.metastore          D  Logging state to mozilla.components.service.fxa.StorageWrapper$PersistenceCallback@b0e1892
2024-03-13 19:22:48.248  5864-5963  FxaStatePe...ceCallback com.igalia.wolvic.metastore          D  Persisting account state into mozilla.components.service.fxa.SharedPrefAccountStorage@415cd03
2024-03-13 19:22:48.249  5864-5963  FirefoxAccount          com.igalia.wolvic.metastore          I  Executing: get access token
2024-03-13 19:22:48.250  5864-5963  fxa_client              com.igalia.wolvic.metastore          D  uniffi_fxa_client_fn_method_firefoxaccount_get_access_token
2024-03-13 19:22:48.656  5864-5963  fxa_client              com.igalia.wolvic.metastore          D  uniffi_fxa_client_fn_method_firefoxaccount_to_json
2024-03-13 19:22:48.656  5864-5963  WrappingPe...ceCallback com.igalia.wolvic.metastore          D  Logging state to mozilla.components.service.fxa.StorageWrapper$PersistenceCallback@b0e1892
2024-03-13 19:22:48.659  5864-5963  FxaStatePe...ceCallback com.igalia.wolvic.metastore          D  Persisting account state into mozilla.components.service.fxa.SharedPrefAccountStorage@49e365f
2024-03-13 19:22:48.659  5864-5963  FirefoxAccount          com.igalia.wolvic.metastore          I  Successfully executed: get access token
2024-03-13 19:22:48.660  5864-5963  FirefoxAccount          com.igalia.wolvic.metastore          I  Executing: getTokenServerEndpointURL
2024-03-13 19:22:48.660  5864-5963  fxa_client              com.igalia.wolvic.metastore          D  uniffi_fxa_client_fn_method_firefoxaccount_get_token_server_endpoint_url
2024-03-13 19:22:48.661  5864-5963  FirefoxAccount          com.igalia.wolvic.metastore          I  Successfully executed: getTokenServerEndpointURL
2024-03-13 19:22:48.662  5864-6071  fxa_client              com.igalia.wolvic.metastore          D  uniffi_fxa_client_fn_method_firefoxaccount_get_current_device_id
2024-03-13 19:22:48.662  5864-6071  FirefoxAcc...ateMachine com.igalia.wolvic.metastore          I  Ran 'AuthData(authData=authType: mozilla.components.concept.sync.AuthType$Signin@90340c7, code: XXX, state: XXX, declinedEngines: null)' side-effects for state Active(progressState=CompletingAuthentication), got successive event CompletedAuthentication(authType=mozilla.components.concept.sync.AuthType$Signin@90340c7)
2024-03-13 19:22:48.662  5864-6071  FirefoxAcc...ateMachine com.igalia.wolvic.metastore          I  Processing event 'CompletedAuthentication(authType=mozilla.components.concept.sync.AuthType$Signin@90340c7)' for state Active(progressState=CompletingAuthentication). Next state is Idle(accountState=Authenticated)
2024-03-13 19:22:48.662  5864-6071  BgSyncManager           com.igalia.wolvic.metastore          D  Enabling...
2024-03-13 19:22:48.662  5864-6071  WMSyncDispatcher        com.igalia.wolvic.metastore          D  Cancelling periodic syncing
2024-03-13 19:22:48.662  5864-6071  WMSyncDispatcher        com.igalia.wolvic.metastore          D  Starting periodic syncing, period = 1440, time unit = MINUTES
2024-03-13 19:22:48.663  5864-6071  BgSyncManager           com.igalia.wolvic.metastore          D  set and initialized new dispatcher: mozilla.components.service.fxa.sync.WorkManagerSyncDispatcher@a19d97b
2024-03-13 19:22:48.663  5864-6071  WMSyncDispatcher        com.igalia.wolvic.metastore          D  Immediate sync requested, reason = mozilla.components.service.fxa.sync.SyncReason$FirstSync@2ca5f9a, debounce = false
2024-03-13 19:22:48.664  5864-5963  FxaDeviceConstellation  com.igalia.wolvic.metastore          I  Executing: changing device name
2024-03-13 19:22:48.665  5864-5963  fxa_client              com.igalia.wolvic.metastore          D  uniffi_fxa_client_fn_method_firefoxaccount_set_device_name
2024-03-13 19:22:48.701  5864-7777  SyncWorker              com.igalia.wolvic.metastore          D  Starting sync... Tagged as: [Immediate, mozilla.components.service.fxa.sync.WorkManagerSyncWorker, Common]
2024-03-13 19:22:48.701  5864-7777  places                  com.igalia.wolvic.metastore          D  uniffi_places_fn_method_placesapi_register_with_sync_manager
2024-03-13 19:22:48.702  5864-7777  places                  com.igalia.wolvic.metastore          D  uniffi_places_fn_method_placesapi_register_with_sync_manager
2024-03-13 19:22:48.702  5864-7777  logins                  com.igalia.wolvic.metastore          D  uniffi_logins_fn_method_loginstore_register_with_sync_manager
2024-03-13 19:22:48.721  5864-7777  logins                  com.igalia.wolvic.metastore          D  uniffi_logins_fn_func_check_canary
2024-03-13 19:22:48.722  5864-7777  sync_manager            com.igalia.wolvic.metastore          D  uniffi_syncmanager_fn_method_syncmanager_sync
2024-03-13 19:22:48.722  5864-7777  sync_manager::manager   com.igalia.wolvic.metastore          I  breadcrumb: SyncManager::sync started
2024-03-13 19:22:48.722  5864-7777  sql_suppor...n_database com.igalia.wolvic.metastore          D  places: opening database
2024-03-13 19:22:48.722  5864-7777  sql_suppor...n_database com.igalia.wolvic.metastore          I  places: database doesn't exist, but we weren't requested to create it
2024-03-13 19:22:48.722  5864-7777  sql_suppor...n_database com.igalia.wolvic.metastore          D  places: opening database
2024-03-13 19:22:48.722  5864-7777  sql_suppor...n_database com.igalia.wolvic.metastore          I  places: database doesn't exist, but we weren't requested to create it
2024-03-13 19:22:48.722  5864-7777  sync_manager::manager   com.igalia.wolvic.metastore          I  breadcrumb: Checking engines requested (Some { engines: ["history", "bookmarks", "passwords"] }) vs local engines (["passwords"])
2024-03-13 19:22:48.724  5864-5894  WM-WorkerWrapper        com.igalia.wolvic.metastore          E  Work [ id=be33bcab-8fd8-4f52-99ac-218bd7e33b25, tags={ mozilla.components.service.fxa.sync.WorkManagerSyncWorker, Common, Immediate } ] failed because it threw an exception/error
                                                                                                    java.util.concurrent.ExecutionException: mozilla.appservices.syncmanager.SyncManagerException$UnsupportedFeature: Manager was compiled without support for "history"
                                                                                                        at androidx.work.impl.utils.futures.AbstractFuture.getDoneValue$1(SourceFile:21)
                                                                                                        at androidx.work.impl.utils.futures.AbstractFuture.get(SourceFile:75)
                                                                                                        at androidx.work.impl.WorkerWrapper$2.run(SourceFile:7)
                                                                                                        at androidx.work.Worker$2.run$androidx$work$impl$utils$SerialExecutorImpl$Task(SourceFile:5)
                                                                                                        at androidx.work.Worker$2.run(SourceFile:824)
                                                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
                                                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
                                                                                                        at java.lang.Thread.run(Thread.java:920)
                                                                                                    Caused by: mozilla.appservices.syncmanager.SyncManagerException$UnsupportedFeature: Manager was compiled without support for "history"
                                                                                                        at mozilla.appservices.syncmanager.FfiConverterTypeSyncManagerError.read(SourceFile:11)
                                                                                                        at mozilla.appservices.syncmanager.FfiConverterTypeSyncManagerError.read(SourceFile:1)
                                                                                                        at mozilla.appservices.syncmanager.FfiConverter$DefaultImpls.liftFromRustBuffer(SourceFile:13)
                                                                                                        at mozilla.appservices.syncmanager.FfiConverterRustBuffer$DefaultImpls.liftFromRustBuffer(SourceFile:6)
                                                                                                        at mozilla.appservices.syncmanager.FfiConverterTypeSyncManagerError.liftFromRustBuffer(SourceFile:2)
                                                                                                        at mozilla.appservices.syncmanager.FfiConverterTypeSyncManagerError.liftFromRustBuffer(SourceFile:1)
                                                                                                        at mozilla.appservices.syncmanager.FfiConverterRustBuffer$DefaultImpls.lift(SourceFile:7)
                                                                                                        at mozilla.appservices.syncmanager.FfiConverterTypeSyncManagerError.lift(SourceFile:3)
                                                                                                        at mozilla.appservices.syncmanager.FfiConverterTypeSyncManagerError.lift(SourceFile:2)
                                                                                                        at mozilla.appservices.syncmanager.SyncManagerException$ErrorHandler.lift(SourceFile:2)
                                                                                                        at mozilla.appservices.syncmanager.SyncManagerException$ErrorHandler.lift(SourceFile:1)
                                                                                                        at mozilla.appservices.syncmanager.SyncmanagerKt.checkCallStatus(SourceFile:75)
                                                                                                        at mozilla.appservices.syncmanager.SyncmanagerKt.access$checkCallStatus(SourceFile:1)
                                                                                                        at mozilla.appservices.syncmanager.SyncManager.sync(SourceFile:69)
                                                                                                        at mozilla.components.service.fxa.sync.WorkManagerSyncWorker.access$doSync(SourceFile:841)
                                                                                                        at mozilla.components.service.fxa.sync.WorkManagerSyncWorker$doWork$2.invokeSuspend(SourceFile:294)
                                                                                                        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:12)
                                                                                                        at kotlinx.coroutines.DispatchedTask.run(SourceFile:129)
                                                                                                        at androidx.work.Worker$2.run(SourceFile:218)
                                                                                                        at kotlinx.coroutines.scheduling.TaskImpl.run(SourceFile:3)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(SourceFile:1)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(SourceFile:63)
2024-03-13 19:22:48.736  5864-5864  VRB[BookmarksStore]     com.igalia.wolvic.metastore          D  Detected that sync is finished, notifying listeners
2024-03-13 19:22:48.736  5864-5864  VRB[HistoryStore]       com.igalia.wolvic.metastore          D  Detected that sync is finished, notifying listeners
2024-03-13 19:22:48.738  5864-5965  places                  com.igalia.wolvic.metastore          D  uniffi_places_fn_method_placesapi_new_connection
2024-03-13 19:22:48.738  5864-5965  sql_suppor...n_database com.igalia.wolvic.metastore          D  places: opening database
2024-03-13 19:22:48.738  5864-5965  sql_suppor...n_database com.igalia.wolvic.metastore          I  places: database doesn't exist, but we weren't requested to create it
2024-03-13 19:22:48.738  5864-5965  error_support::handling com.igalia.wolvic.metastore          E  Error opening database: Error executing SQL: unable to open database file: /data/data/com.igalia.wolvic.metastore/files/places.sqlite
2024-03-13 19:22:48.739  5864-5965  PlacesBookmarksStorage  com.igalia.wolvic.metastore          W  Ignoring PlacesApiException while running getBookmarkWithUrl
                                                                                                    mozilla.appservices.places.uniffi.PlacesApiException$UnexpectedPlacesException: reason=Error opening database: Error executing SQL: unable to open database file: /data/data/com.igalia.wolvic.metastore/files/places.sqlite
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterTypePlacesApiError.read(SourceFile:21)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterTypePlacesApiError.read(SourceFile:1)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverter$DefaultImpls.liftFromRustBuffer(SourceFile:13)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterRustBuffer$DefaultImpls.liftFromRustBuffer(SourceFile:6)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterTypePlacesApiError.liftFromRustBuffer(SourceFile:2)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterTypePlacesApiError.liftFromRustBuffer(SourceFile:1)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterRustBuffer$DefaultImpls.lift(SourceFile:7)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterTypePlacesApiError.lift(SourceFile:3)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterTypePlacesApiError.lift(SourceFile:2)
                                                                                                        at mozilla.appservices.places.uniffi.PlacesApiException$ErrorHandler.lift(SourceFile:2)
                                                                                                        at mozilla.appservices.places.uniffi.PlacesApiException$ErrorHandler.lift(SourceFile:1)
                                                                                                        at mozilla.appservices.places.uniffi.PlacesKt.checkCallStatus(SourceFile:75)
                                                                                                        at mozilla.appservices.places.uniffi.PlacesKt.access$checkCallStatus(SourceFile:1)
                                                                                                        at mozilla.appservices.places.uniffi.PlacesApi.newConnection(SourceFile:69)
                                                                                                        at mozilla.appservices.places.PlacesApi.openReader(SourceFile:2)
                                                                                                        at mozilla.components.browser.storage.sync.RustPlacesConnection.init(SourceFile:42)
                                                                                                        at mozilla.components.browser.storage.sync.PlacesStorage$places$2.invoke(SourceFile:37)
                                                                                                        at kotlin.SynchronizedLazyImpl.getValue(SourceFile:21)
                                                                                                        at mozilla.components.browser.storage.sync.PlacesStorage.getPlaces$browser_storage_sync_release(SourceFile:3)
                                                                                                        at mozilla.components.browser.storage.sync.PlacesStorage$places$2.invoke(SourceFile:17)
                                                                                                        at kotlin.SynchronizedLazyImpl.getValue(SourceFile:21)
                                                                                                        at mozilla.components.browser.storage.sync.PlacesStorage.getReader$browser_storage_sync_release(SourceFile:3)
                                                                                                        at mozilla.components.browser.storage.sync.PlacesBookmarksStorage$getBookmarksWithUrl$2.invokeSuspend(SourceFile:15)
                                                                                                        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:12)
                                                                                                        at kotlinx.coroutines.DispatchedTask.run(SourceFile:129)
                                                                                                        at androidx.work.Worker$2.run(SourceFile:218)
                                                                                                        at kotlinx.coroutines.scheduling.TaskImpl.run(SourceFile:3)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(SourceFile:1)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(SourceFile:63)
2024-03-13 19:22:48.740  5864-7777  places                  com.igalia.wolvic.metastore          D  uniffi_places_fn_method_placesapi_new_connection
2024-03-13 19:22:48.740  5864-7777  sql_suppor...n_database com.igalia.wolvic.metastore          D  places: opening database
2024-03-13 19:22:48.740  5864-7777  sql_suppor...n_database com.igalia.wolvic.metastore          I  places: database doesn't exist, but we weren't requested to create it
2024-03-13 19:22:48.740  5864-7777  error_support::handling com.igalia.wolvic.metastore          E  Error opening database: Error executing SQL: unable to open database file: /data/data/com.igalia.wolvic.metastore/files/places.sqlite
2024-03-13 19:22:48.741  5864-7777  PlacesBookmarksStorage  com.igalia.wolvic.metastore          W  Ignoring PlacesApiException while running getTree
                                                                                                    mozilla.appservices.places.uniffi.PlacesApiException$UnexpectedPlacesException: reason=Error opening database: Error executing SQL: unable to open database file: /data/data/com.igalia.wolvic.metastore/files/places.sqlite
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterTypePlacesApiError.read(SourceFile:21)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterTypePlacesApiError.read(SourceFile:1)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverter$DefaultImpls.liftFromRustBuffer(SourceFile:13)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterRustBuffer$DefaultImpls.liftFromRustBuffer(SourceFile:6)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterTypePlacesApiError.liftFromRustBuffer(SourceFile:2)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterTypePlacesApiError.liftFromRustBuffer(SourceFile:1)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterRustBuffer$DefaultImpls.lift(SourceFile:7)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterTypePlacesApiError.lift(SourceFile:3)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterTypePlacesApiError.lift(SourceFile:2)
                                                                                                        at mozilla.appservices.places.uniffi.PlacesApiException$ErrorHandler.lift(SourceFile:2)
                                                                                                        at mozilla.appservices.places.uniffi.PlacesApiException$ErrorHandler.lift(SourceFile:1)
                                                                                                        at mozilla.appservices.places.uniffi.PlacesKt.checkCallStatus(SourceFile:75)
                                                                                                        at mozilla.appservices.places.uniffi.PlacesKt.access$checkCallStatus(SourceFile:1)
                                                                                                        at mozilla.appservices.places.uniffi.PlacesApi.newConnection(SourceFile:69)
                                                                                                        at mozilla.appservices.places.PlacesApi.openReader(SourceFile:2)
                                                                                                        at mozilla.components.browser.storage.sync.RustPlacesConnection.init(SourceFile:42)
                                                                                                        at mozilla.components.browser.storage.sync.PlacesStorage$places$2.invoke(SourceFile:37)
                                                                                                        at kotlin.SynchronizedLazyImpl.getValue(SourceFile:21)
                                                                                                        at mozilla.components.browser.storage.sync.PlacesStorage.getPlaces$browser_storage_sync_release(SourceFile:3)
                                                                                                        at mozilla.components.browser.storage.sync.PlacesStorage$places$2.invoke(SourceFile:17)
                                                                                                        at kotlin.SynchronizedLazyImpl.getValue(SourceFile:21)
                                                                                                        at mozilla.components.browser.storage.sync.PlacesStorage.getReader$browser_storage_sync_release(SourceFile:3)
                                                                                                        at mozilla.components.browser.storage.sync.PlacesBookmarksStorage$getTree$2.invokeSuspend(SourceFile:12)
                                                                                                        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:12)
                                                                                                        at kotlinx.coroutines.DispatchedTask.run(SourceFile:129)
                                                                                                        at androidx.work.Worker$2.run(SourceFile:218)
                                                                                                        at kotlinx.coroutines.scheduling.TaskImpl.run(SourceFile:3)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(SourceFile:1)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(SourceFile:63)
2024-03-13 19:22:48.742  5864-5955  places                  com.igalia.wolvic.metastore          D  uniffi_places_fn_method_placesapi_new_connection
2024-03-13 19:22:48.742  5864-5955  sql_suppor...n_database com.igalia.wolvic.metastore          D  places: opening database
2024-03-13 19:22:48.742  5864-5955  sql_suppor...n_database com.igalia.wolvic.metastore          I  places: database doesn't exist, but we weren't requested to create it
2024-03-13 19:22:48.742  5864-5955  error_support::handling com.igalia.wolvic.metastore          E  Error opening database: Error executing SQL: unable to open database file: /data/data/com.igalia.wolvic.metastore/files/places.sqlite
2024-03-13 19:22:48.744  5864-5955  PlacesHistoryStorage    com.igalia.wolvic.metastore          W  Ignoring PlacesApiException while running getDetailedVisits
                                                                                                    mozilla.appservices.places.uniffi.PlacesApiException$UnexpectedPlacesException: reason=Error opening database: Error executing SQL: unable to open database file: /data/data/com.igalia.wolvic.metastore/files/places.sqlite
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterTypePlacesApiError.read(SourceFile:21)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterTypePlacesApiError.read(SourceFile:1)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverter$DefaultImpls.liftFromRustBuffer(SourceFile:13)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterRustBuffer$DefaultImpls.liftFromRustBuffer(SourceFile:6)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterTypePlacesApiError.liftFromRustBuffer(SourceFile:2)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterTypePlacesApiError.liftFromRustBuffer(SourceFile:1)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterRustBuffer$DefaultImpls.lift(SourceFile:7)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterTypePlacesApiError.lift(SourceFile:3)
                                                                                                        at mozilla.appservices.places.uniffi.FfiConverterTypePlacesApiError.lift(SourceFile:2)
                                                                                                        at mozilla.appservices.places.uniffi.PlacesApiException$ErrorHandler.lift(SourceFile:2)
                                                                                                        at mozilla.appservices.places.uniffi.PlacesApiException$ErrorHandler.lift(SourceFile:1)
                                                                                                        at mozilla.appservices.places.uniffi.PlacesKt.checkCallStatus(SourceFile:75)
                                                                                                        at mozilla.appservices.places.uniffi.PlacesKt.access$checkCallStatus(SourceFile:1)
                                                                                                        at mozilla.appservices.places.uniffi.PlacesApi.newConnection(SourceFile:69)
                                                                                                        at mozilla.appservices.places.PlacesApi.openReader(SourceFile:2)
                                                                                                        at mozilla.components.browser.storage.sync.RustPlacesConnection.init(SourceFile:42)
                                                                                                        at mozilla.components.browser.storage.sync.PlacesStorage$places$2.invoke(SourceFile:37)
                                                                                                        at kotlin.SynchronizedLazyImpl.getValue(SourceFile:21)
                                                                                                        at mozilla.components.browser.storage.sync.PlacesStorage.getPlaces$browser_storage_sync_release(SourceFile:3)
                                                                                                        at mozilla.components.browser.storage.sync.PlacesHistoryStorage$getDetailedVisits$2.invokeSuspend(SourceFile:19)
                                                                                                        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:12)
                                                                                                        at kotlinx.coroutines.DispatchedTask.run(SourceFile:129)
                                                                                                        at androidx.work.Worker$2.run(SourceFile:218)
                                                                                                        at kotlinx.coroutines.scheduling.TaskImpl.run(SourceFile:3)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(SourceFile:1)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(SourceFile:63)
2024-03-13 19:22:48.784  5864-5921  VrRuntimeClient         com.igalia.wolvic.metastore          I  UpdateEvents: HMT was mounted
2024-03-13 19:22:48.878  5864-5963  fxa_client              com.igalia.wolvic.metastore          D  uniffi_fxa_client_fn_method_firefoxaccount_to_json
2024-03-13 19:22:48.878  5864-5963  WrappingPe...ceCallback com.igalia.wolvic.metastore          D  Logging state to mozilla.components.service.fxa.StorageWrapper$PersistenceCallback@b0e1892
2024-03-13 19:22:48.882  5864-5963  FxaStatePe...ceCallback com.igalia.wolvic.metastore          D  Persisting account state into mozilla.components.service.fxa.SharedPrefAccountStorage@75dcb09
2024-03-13 19:22:48.882  5864-5963  FxaDeviceConstellation  com.igalia.wolvic.metastore          I  Successfully executed: changing device name
2024-03-13 19:22:48.882  5864-5963  FxaDeviceConstellation  com.igalia.wolvic.metastore          I  Refreshing device list...
2024-03-13 19:22:48.883  5864-5963  FxaDeviceConstellation  com.igalia.wolvic.metastore          I  Executing: fetching all devices
2024-03-13 19:22:48.883  5864-5963  fxa_client              com.igalia.wolvic.metastore          D  uniffi_fxa_client_fn_method_firefoxaccount_get_devices
2024-03-13 19:22:48.984  5864-5921  TREX                    com.igalia.wolvic.metastore          E  Interface 'InsightMrLightingEstimationInterface', version 1 was not found. Check debug build for more information.
2024-03-13 19:22:49.002  5864-8072  VrApi                   com.igalia.wolvic.metastore          I  FPS=90/90,Prd=26ms,Tear=0,Early=0,Stale=0,Stale2/5/10/max=0/0/0/0,VSnc=1,Lat=-1,Fov=0,CPU4/GPU=2/1,1171/400MHz,OC=FF,TA=0/0/0,SP=N/N/N,Mem=1555MHz,Free=2458MB,PLS=0,Temp=32.5C/0.0C,TW=3.83ms,App=1.71ms,GD=0.00ms,CPU&GPU=4.84ms,LCnt=5(DR0,LM0),GPU%=0.52,CPU%=0.23(W0.36),DSF=1.00,CFL=12.82/20.00,ICFLp95=15.85,LD=0,SF=1.00,LP=0,DVFS=0
2024-03-13 19:22:49.147  5864-5963  FxaDeviceConstellation  com.igalia.wolvic.metastore          I  Successfully executed: fetching all devices
2024-03-13 19:22:49.147  5864-5963  FxaDeviceConstellation  com.igalia.wolvic.metastore          I  Current device needs push endpoint registration, so checking for missed commands
2024-03-13 19:22:49.147  5864-5963  FxaDeviceConstellation  com.igalia.wolvic.metastore          I  Executing: polling for device commands
2024-03-13 19:22:49.147  5864-5963  fxa_client              com.igalia.wolvic.metastore          D  uniffi_fxa_client_fn_method_firefoxaccount_poll_device_commands
2024-03-13 19:22:49.349  5864-5963  fxa_client              com.igalia.wolvic.metastore          D  uniffi_fxa_client_fn_method_firefoxaccount_to_json
2024-03-13 19:22:49.349  5864-5963  WrappingPe...ceCallback com.igalia.wolvic.metastore          D  Logging state to mozilla.components.service.fxa.StorageWrapper$PersistenceCallback@b0e1892
2024-03-13 19:22:49.353  5864-5963  FxaStatePe...ceCallback com.igalia.wolvic.metastore          D  Persisting account state into mozilla.components.service.fxa.SharedPrefAccountStorage@d4513c
2024-03-13 19:22:49.353  5864-5963  FxaDeviceConstellation  com.igalia.wolvic.metastore          I  Successfully executed: polling for device commands
2024-03-13 19:22:49.353  5864-5963  AccountEve...ntegration com.igalia.wolvic.metastore          I  Received events, notifying listeners
2024-03-13 19:22:49.353  5864-5864  DeviceEventsObserver    com.igalia.wolvic.metastore          I  Received 0 device event(s)
2024-03-13 19:22:49.353  5864-5963  fxa_client              com.igalia.wolvic.metastore          D  uniffi_fxa_client_fn_method_firefoxaccount_gather_telemetry
2024-03-13 19:22:49.354  5864-5963  FxaDeviceConstellation  com.igalia.wolvic.metastore          I  Refreshed device list; saw 5 device(s).
2024-03-13 19:22:49.354  5864-5963  FxaDeviceConstellation  com.igalia.wolvic.metastore          I  Notifying observer about constellation updates.
2024-03-13 19:22:49.354  5864-5864  FxaDeviceConstellation  com.igalia.wolvic.metastore          D  registering device observer
2024-03-13 19:22:49.355  5864-6071  WMSyncDispatcher        com.igalia.wolvic.metastore          D  Immediate sync requested, reason = mozilla.components.service.fxa.sync.SyncReason$EngineChange@22b1e38, debounce = true
2024-03-13 19:22:49.355  5864-5963  FirefoxAccount          com.igalia.wolvic.metastore          I  Executing: getProfile
2
javifernandez commented 8 months ago

In this case the synchronization always fails and there is no way to recover from that status, unless clearing again the appś data.

javifernandez commented 8 months ago

When the checkbox is activated in the sign-out dialog, we call to the Places::clear() method, which deletes the places.sqlite files from the user data folder and creates new PlacesBookmarksStorage and PlacesHistoryStorage instances.

The original idea of this clear() method was that the sqlite files will be regenerated when creating the new instances mentioned before. However. this only happens if the places api pointer is null. This is the case during the app startup, but not when we are executing the clearing logic.

From the comments in the Places class we can figure out the intentions of this logic; the PlacesStorage::cleanup() method calls to RustPlacesConnection::close() which sets the places api pointer to null.

However, the cleanup() method has been marked as deprecated due to this bug and it's suggested to use cancelWrites and cancelReads instead. However, these methods doesn't set the places api pointer to null, so the sqlite files are not created when creating the new instances of the PlacesBookmarksStorage and PlacesHistoryStorage as it was the intention of this method.