stefan-niedermann / nextcloud-deck

📋 Android client for nextcloud deck app
https://play.google.com/store/apps/details?id=it.niedermann.nextcloud.deck.play
GNU General Public License v3.0
494 stars 53 forks source link

Fragment manager destroyed #1135

Open hansimausisteffiwurstbrot opened 2 years ago

hansimausisteffiwurstbrot commented 2 years ago

Will continue to add info asap.

Describe the bug The app seems to have issues syncing new cards. After creating a new one, it takes about a minute before there is any response and usually the following error message appers.

After a while, the app achieves a sync, but the error is problematic for me.

Steps to reproduce the behavior:

  1. Add a card and save it
  2. wait
  3. See error

Expected behavior Card created and synced.

Versions

Smartphone (please complete the following information):

Error message

Full Crash:

App Version: 1.19.4
App Version Code: 1019004
App Flavor: play

Files App Version Code: 30170190

---

OS Version: 3.18.71-perf-g0f5ce2e(ABT975)
OS API Level: 27
Device: bbb100
Manufacturer: BlackBerry
Model (and Product): BBB100-2 (bbb100emea)

---

java.lang.IllegalStateException: FragmentManager has been destroyed
    at androidx.fragment.app.FragmentManager.enqueueAction(FragmentManager.java:1878)
    at androidx.fragment.app.BackStackRecord.commitInternal(BackStackRecord.java:329)
    at androidx.fragment.app.BackStackRecord.commit(BackStackRecord.java:294)
    at androidx.fragment.app.DialogFragment.show(DialogFragment.java:260)
    at it.niedermann.nextcloud.deck.ui.card.CardAdapter$1.lambda$onError$0$CardAdapter$1(CardAdapter.java:235)
    at it.niedermann.nextcloud.deck.ui.card.CardAdapter$1$$ExternalSyntheticLambda0.run(Unknown Source:6)
    at android.os.Handler.handleCallback(Handler.java:790)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6558)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)
hansimausisteffiwurstbrot commented 2 years ago

Another crash, no idea if it's related..

Full Crash:

App Version: 1.19.4
App Version Code: 1019004
App Flavor: play

Files App Version Code: 30170190

---

OS Version: 3.18.71-perf-g0f5ce2e(ABT975)
OS API Level: 27
Device: bbb100
Manufacturer: BlackBerry
Model (and Product): BBB100-2 (bbb100emea)

---

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
    at androidx.fragment.app.FragmentManager.checkStateLoss(FragmentManager.java:1844)
    at androidx.fragment.app.FragmentManager.enqueueAction(FragmentManager.java:1884)
    at androidx.fragment.app.BackStackRecord.commitInternal(BackStackRecord.java:329)
    at androidx.fragment.app.BackStackRecord.commit(BackStackRecord.java:294)
    at androidx.fragment.app.DialogFragment.show(DialogFragment.java:260)
    at it.niedermann.nextcloud.deck.ui.card.NewCardDialog$2.lambda$onError$1$NewCardDialog$2(NewCardDialog.java:183)
    at it.niedermann.nextcloud.deck.ui.card.NewCardDialog$2$$ExternalSyntheticLambda0.run(Unknown Source:4)
    at android.os.Handler.handleCallback(Handler.java:790)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6558)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)
stefan-niedermann commented 2 years ago

Dear @hansimausisteffiwurstbrot

sorry for the inconveniences. We are looking on what might be wrong here and have a few questions:

  1. Does it always take so much time to create new cards?
  2. Does it only take much time until the new card is synchronized to the server or does it also take so much time until the card is there on your local device?
  3. Have you tried to clear the storage of the Deck Android app and reimport your account to get a clean state?
  4. Are you able to reproduce this issue on another device (maybe a friend or a coworker)? (You can simply install it from F-Droid to avoid paying it a second time)
  5. Can you tell us something about your server environment? Are we talking about a hosted Nextcloud anywhere, selfhosted, Raspberry Pi, ...?

Again i am sorry. Noone else reported this kind of issue yet, so i guess it is likely a local environment issue. If you want us to refund your money you can of course just send your Play Store order ID to info@niedermann.it at any time.

Regards Stefan

hansimausisteffiwurstbrot commented 2 years ago

Clearing the storage solved the problem.

Thanks for the hint!

stefan-niedermann commented 2 years ago

Glad to hear that it finally works for you! It looks like the cause of the issue is related to https://github.com/stefan-niedermann/nextcloud-deck/issues/478 so i'll have a deeper look at the error message you posted. Thanks for the report!

hansimausisteffiwurstbrot commented 2 years ago

Sorry to say it's not solved.

The errors started to reappear.

I tried deleting the data&cache and un- and reinstalling both Nextcloud and Nextcloud Deck and now it turned unusable. After configuring the Nextcloud App, I can't select the account in Nextcloud Deck.

A cascade of error messages appears, all the same:

App Version: 1.19.4
App Version Code: 1019004
Server App Version: 1.4.7
App Flavor: play

Files App Version Code: 30180090

---

OS Version: 3.18.71-perf-g0f5ce2e(ABT975)
OS API Level: 27
Device: bbb100
Manufacturer: BlackBerry
Model (and Product): BBB100-2 (bbb100emea)

---

android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (code 787)
    at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
    at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:783)
    at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:788)
    at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:86)
    at androidx.sqlite.db.framework.FrameworkSQLiteStatement.executeInsert(FrameworkSQLiteStatement.java:51)
    at androidx.room.EntityInsertionAdapter.insertAndReturnId(EntityInsertionAdapter.java:114)
    at it.niedermann.nextcloud.deck.persistence.sync.adapters.db.dao.StackDao_Impl.insert(StackDao_Impl.java:183)
    at it.niedermann.nextcloud.deck.persistence.sync.adapters.db.dao.StackDao_Impl.insert(StackDao_Impl.java:33)
    at it.niedermann.nextcloud.deck.persistence.sync.adapters.db.DataBaseAdapter.createStack(DataBaseAdapter.java:632)
    at it.niedermann.nextcloud.deck.persistence.sync.helpers.providers.StackDataProvider.createInDB(StackDataProvider.java:44)
    at it.niedermann.nextcloud.deck.persistence.sync.helpers.providers.StackDataProvider.createInDB(StackDataProvider.java:20)
    at it.niedermann.nextcloud.deck.persistence.sync.helpers.SyncHelper$1.onResponse(SyncHelper.java:62)
    at it.niedermann.nextcloud.deck.persistence.sync.helpers.SyncHelper$1.onResponse(SyncHelper.java:47)
    at it.niedermann.nextcloud.deck.api.RequestHelper$ResponseConsumer.accept(RequestHelper.java:66)
    at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:63)
    at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeOnObserver.onNext(ObservableSubscribeOn.java:58)
    at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:62)
    at io.reactivex.internal.operators.observable.ObservableFromPublisher$PublisherSubscriber.onNext(ObservableFromPublisher.java:56)
    at com.nextcloud.android.sso.api.NextcloudAPI.lambda$performRequestObservableV2$1$NextcloudAPI(NextcloudAPI.java:111)
    at com.nextcloud.android.sso.api.NextcloudAPI$$ExternalSyntheticLambda0.subscribe(Unknown Source:6)
    at io.reactivex.internal.operators.observable.ObservableFromPublisher.subscribeActual(ObservableFromPublisher.java:31)
    at io.reactivex.Observable.subscribe(Observable.java:12284)
    at io.reactivex.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:32)
    at io.reactivex.Observable.subscribe(Observable.java:12284)
    at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
    at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
    at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    at java.lang.Thread.run(Thread.java:764)
hansimausisteffiwurstbrot commented 2 years ago

The message appeared while the app was importing boards".

I tried several times, then the app seemed stuck loading the boards. I killed it and then was able to open the app, but the entire profile was blank.

hansimausisteffiwurstbrot commented 2 years ago

Now the app tries to import boards for a minute before it states that it can't reatch the Nexctloud. The Nextcloud is up and running and reachable from that device, though.

The following message appears:

`

Full Crash:

App Version: 1.19.4
App Version Code: 1019004
App Flavor: play

Files App Version Code: 30180090

---

OS Version: 3.18.71-perf-g0f5ce2e(ABT975)
OS API Level: 27
Device: bbb100
Manufacturer: BlackBerry
Model (and Product): BBB100-2 (bbb100emea)

---

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
    at androidx.fragment.app.FragmentManager.checkStateLoss(FragmentManager.java:1844)
    at androidx.fragment.app.FragmentManager.enqueueAction(FragmentManager.java:1884)
    at androidx.fragment.app.BackStackRecord.commitInternal(BackStackRecord.java:329)
    at androidx.fragment.app.BackStackRecord.commit(BackStackRecord.java:294)
    at androidx.fragment.app.DialogFragment.show(DialogFragment.java:260)
    at it.niedermann.nextcloud.deck.ui.ImportAccountActivity$1$1$1.lambda$onError$4$ImportAccountActivity$1$1$1(ImportAccountActivity.java:184)
    at it.niedermann.nextcloud.deck.ui.ImportAccountActivity$1$1$1$$ExternalSyntheticLambda4.run(Unknown Source:6)
    at android.os.Handler.handleCallback(Handler.java:790)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6558)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)

`

desperateCoder commented 2 years ago

@hansimausisteffiwurstbrot could you please try the version provided in the following comment?

https://github.com/stefan-niedermann/nextcloud-deck/issues/1117#issuecomment-969110504

This is a dev-build and is safe to install beside your actual app. The icon will hava a "DEV" label on it. If you already have a dev-version installed, I'd recommend to uninstall it first.

hansimausisteffiwurstbrot commented 2 years ago

@hansimausisteffiwurstbrot could you please try the version provided in the following comment?

#1117 (comment)

Great! Installation worked like a charm and new cards are fixed instantly. Thanks!

Any idea when I this version will be rolled out so I can switch back to the general version?

I'll close this issue and hope to leave it sealed. :)

desperateCoder commented 2 years ago

@hansimausisteffiwurstbrot you really don't want to have this version running, trust me! It is swallowing insane amounts of RAM for storing useless debug logs in case the app crashes. Why this version works better than the official one? I have no damn clue tbh. All it does different is storing the logs and spit them out in case something crashes.

Could you please try the version in this post and confirm it is working as well? Please make sure to uninstall the current dev build before.

If it works as well, I'll talk to @stefan-niedermann to get this version released soon, since the current one behaves quite odd, and I really have no idea why... Crazy times...

hansimausisteffiwurstbrot commented 2 years ago

Tried it and the following crash report appeared while it was importing the first board.

I'll guess I'll stick to the ram consuming one, it's better than none.

`

Full Crash:

App Version: 1.19.6
App Version Code: 1019006
App Flavor: dev

Files App Version Code: 30180090

---

OS Version: 3.18.71-perf-g0f5ce2e(ABT975)
OS API Level: 27
Device: bbb100
Manufacturer: BlackBerry
Model (and Product): BBB100-2 (bbb100emea)

---

android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed. 
    at android.database.CursorWindow.<init>(CursorWindow.java:108)
    at android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java:198)
    at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:138)
    at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:132)
    at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:220)
    at android.database.AbstractCursor.moveToNext(AbstractCursor.java:269)
    at androidx.room.InvalidationTracker$1.checkUpdatedTable(InvalidationTracker.java:464)
    at androidx.room.InvalidationTracker$1.run(InvalidationTracker.java:431)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    at java.lang.Thread.run(Thread.java:764)

`

desperateCoder commented 2 years ago

@hansimausisteffiwurstbrot nah buddy, not on my watch.

Take this one: ( ͡° ͜ʖ ͡°)_/¯ APK

This is the exact same as before, but without wasting the RAM.

hansimausisteffiwurstbrot commented 2 years ago

Thanks! :)

And now it's getting more confusing: none of the linked versions achieve to import the boards. Any way to get rid of possible config data in addition to uninstalling?

stefan-niedermann commented 2 years ago

Any way to get rid of possible config data in addition to uninstalling?

@hansimausisteffiwurstbrot yes, we always recommend to clear thw storage of the Deck app in favor of uninstalling it, because Google (🖕) decided to keep some data when uninstalling an app. You can achieve this (depending on your manufacturer) by going to your Android settings -> Apps -> Deck -> Storage -> Clear storage.

I am also sorry for the inconveniences, but it looks like you are stumbling from one bad-luck issue to another. I am hughlx grateful that you are going through this torture with us 🙏

hansimausisteffiwurstbrot commented 2 years ago

Thanks!

I tried that one and now it seems fine so far. Although an error message appears when importing the boards, the latest linked version now works well and syncs new cards without hickup.

I'll report in case it f*cks up again.

No worries, I'm really thankful for your support! And it shows me, that we're doing good in supporting you with money from the Freiheitswolke.

🙏 !

hansimausisteffiwurstbrot commented 2 years ago

From time to time the error appears after creating a new card. Much less often, though.

Syncing takes some time then, but it works after a while.

hansimausisteffiwurstbrot commented 2 years ago

I'm still having problems with the sync.

Another user of our Nextcloud just commented that he has troubles with the sync, too. I asked him to send me the error message and I'll ask other users if they experience sync troubles, too.

Is there any updated version I can try?

hansimausisteffiwurstbrot commented 2 years ago

Hey,

I switched the device (still on the BB KeyOne, though) and this issue makes the app unusable.

I'm on the beta/testing channel via the Play store.

Could you provide me with another version that might run better?

After deleting the memory of both the NC main app and the Deck app it runs fine for a short time (like hours at max) then it stops syncing and gives out the following error message.

The server is reachable and there is no issue with other devices, though.

App Version: 1.20.0
App Version Code: 1020000
Server App Version: 1.4.7
App Flavor: play

Files App Version Code: 30180190

---

OS Version: 3.18.71-perf-g0f5ce2e(ABT975)
OS API Level: 27
Device: bbb100
Manufacturer: BlackBerry
Model (and Product): BBB100-2 (bbb100emea)

---

com.nextcloud.android.sso.exceptions.UnknownErrorException: failed to connect to cloud.freiheitswolke.org/2a01:4f8:141:f5::2 (port 443) from /2a01:598:928b:130e:14c5:2e5b:3bc4:e445 (port 47721) after 60000ms
    at com.nextcloud.android.sso.api.AidlNetworkRequest.performNetworkRequestV2(AidlNetworkRequest.java:188)
    at com.nextcloud.android.sso.api.NextcloudAPI.performNetworkRequestV2(NextcloudAPI.java:199)
    at com.nextcloud.android.sso.api.NextcloudAPI.lambda$performRequestObservableV2$1$com-nextcloud-android-sso-api-NextcloudAPI(NextcloudAPI.java:129)
    at com.nextcloud.android.sso.api.NextcloudAPI$$ExternalSyntheticLambda2.subscribe(Unknown Source:6)
    at io.reactivex.internal.operators.observable.ObservableFromPublisher.subscribeActual(ObservableFromPublisher.java:31)
    at io.reactivex.Observable.subscribe(Observable.java:12284)
    at io.reactivex.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:32)
    at io.reactivex.Observable.subscribe(Observable.java:12284)
    at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
    at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
    at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    at java.lang.Thread.run(Thread.java:764)
desperateCoder commented 2 years ago

Hi @hansimausisteffiwurstbrot, sorry to hear! Any chance you just had a temporary problem with your internet connection? Or that your server was too busy or offline?

The error message indicates, that the connection to the server has failed. In fact we just worked a little on that, it will be shipped with the next version 1.20.1, but your particular case isn't covered there. We can add this case as well, so the app wouldn't crash and just wait for a stable connection for the sync, but I'm not quite sure if this is your point? Are you saying the app shouldn't crash or are you saying your connection was just fine but the app didn't work properly anyway?

hansimausisteffiwurstbrot commented 2 years ago

Hi @hansimausisteffiwurstbrot, sorry to hear! Any chance you just had a temporary problem with your internet connection? Or that your server was too busy or offline?

I was sure it couldn't be the case, but now it's working again. :)

Thank you for your swift response!

desperateCoder commented 2 years ago

You're welcome buddy! But just to make sure: did the app actually crash? Or did it just show a toast and you gathered the error information from there?

I'm asking because if I'd DID crash, i'd add a few lines to prevent that.

Your particular case may happen, eg. if your server infrastructure is being currently maintained, the internet connection dies in an unfortunate timing constellation or for many other reasons that are not necessarily transparent to the user. If this leads to a full crash of the app, I'd like to know and fix that

hansimausisteffiwurstbrot commented 2 years ago

Hey, what to you mean by "just show a toast". Is the question whether the app showed the error message or just silently crashed?

desperateCoder commented 2 years ago

@hansimausisteffiwurstbrot there are 3 types of crashes:

  1. Full crash without any information, the app is just gone
  2. Full crash, showing a stack trace and hints to report the issue
  3. There is a little popup saying that something went wrong. You can continue using the app

Which one was it?