Closed TtuxX closed 2 years ago
@desperateCoder looks like the issue we already knew about regarding too much activity on the database?
Maybe we should try to limit certain synchronization steps to batches? The change shouldn't be too big because we already are running te stuff on CachedThreadpoolExecutor
s which could be changed to executors with a fixed thread pool size?
@TtuxX this is just a trial and error, but I'd like to ask you to test this debug build (download, unzip and install it - it can be used alongside the Deck Android app from F-Droid). It will be slower then you might be used to because I chose a quite low limit (10
) of parallel actions just to see whether this fixes the issue at all. Please note that this build requires the Nextcloud Android app to be at least version 3.18.x
, so make sure that you have a recent version - your Dev build of Nextcloud Android seems to be a bit outdated.
We can make a build with strict mode enabled (detectLeakedClosableObjects
and (detectLeakedSqLiteObjects
), I'll try that as soon as I find time for that and post the APK here. Since I can't reproduce that behavior, i depend on your help here @TtuxX
Thank you very much to you both for your kind help and for being so responsive!
@stefan-niedermann I confirm your debug build - while indeed slower - works, and import of large deck entries works fine! When I closed the app and started it again, tables where imported and ready to use.
At some point however during my tests with your new debug app I got an error message that I cannot reliably reproduce for now:
App Version: 1.20.0
App Version Code: 1020000
Server App Version: 1.6.0
App Flavor: dev
Files App Version Code: 30020499
---
OS Version: 4.4.23+(157(C432))
OS API Level: 26
Device: HWBLA
Manufacturer: HUAWEI
Model (and Product): BLA-L29 (BLA-L29)
---
android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (Sqlite code 787), (OS error - 11:Try again)
at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:818
at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:803)
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.UserDao_Impl.insert(UserDao_Impl.java:177)
at it.niedermann.nextcloud.deck.persistence.sync.adapters.db.dao.UserDao_Impl.insert(UserDao_Impl.java:29)
at it.niedermann.nextcloud.deck.persistence.sync.adapters.db.DataBaseAdapter.createUser(DataBaseAdapter.java:358)
at it.niedermann.nextcloud.deck.persistence.sync.helpers.providers.CardDataProvider.fixRelations(CardDataProvider.java:96)
at it.niedermann.nextcloud.deck.persistence.sync.helpers.providers.CardDataProvider.createInDB(CardDataProvider.java:79)
at it.niedermann.nextcloud.deck.persistence.sync.helpers.providers.CardDataProvider.createInDB(CardDataProvider.java:32)
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.persistence.sync.helpers.providers.CardDataProvider$1.onResponse(CardDataProvider.java:59)
at it.niedermann.nextcloud.deck.persistence.sync.helpers.providers.CardDataProvider$1.onResponse(CardDataProvider.java:54)
at it.niedermann.nextcloud.deck.api.RequestHelper$ResponseConsumer.accept(RequestHelper.java:56)
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$com-nextcloud-android-sso-api-NextcloudAPI(NextcloudAPI.java:130)
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:784)
Note: I updated my Nextcloud Dev app to the very last version as you suggested and I now remember why I was keeping this old version: Notes app does not work anymore as it does not see my account I added again on the Nextcloud Dev app, and throws an Attempt to invoke virtual method 'java.lang.String android.virtual.content.Intent.getStringExtra(java.lang.String)' on a null object reference
.
@desperateCoder No worries, thank you for your precious help, I remain of course at your entire disposal to help you try test versions and debug this issue!
@TtuxX thanks for the feedback! Yeah, let's focus on one issue after another - as I mentioned, this was a hard limit to check whether it solves the issue at all. Before we can push the changes to production, we need to try a few more real world scenarios.
It would be great if you could clear the storage of the Deck Android Dev app, uninstall it and then test this build - does the import still work? How is the performance compared to the version of September you mentioned and how is the performance compared to the first debug build?
Thank you @stefan-niedermann ! The app loads faster than the previous one but crashes at the exact same point than the current Master version of Deck app available on F-Droid. It throws again the same "Cursor window allocation of 2048 kb failed.", with a subliminal message "Too many open files" just before the crash pop-up.
@TtuxX could you please test this APK and gather logcat-logs? If your device is rooted maybe via MatLog or if not via ADB (adb logcat > log.txt
)? It should now log possible violations, so we can find the leak.
What I'm interested in is the logs from right before you start the app until it crashes. There might be some private data in it, since the logging outputs the contents of your cards, but I just need the parts stating something about a "violation".
So if you have recorded the logs, just search for the word "violation" and copy the found blocks here (there might be multiple blocks).
That would help a lot! Thanks in advance! And of course, if you need help gathering the logs, just ask!
@desperateCoder Thank you for your help ! I have my log file ready but have not found any occurrence of "violation" keyword. Where could I privately upload my log file for you to access it ? Do you have an e-mail address or something else I could join you at ?
@TtuxX the posted log is already quite interesting, but if you don't mind I'd like see the full one, too. You can mail it to @stefan-niedermann (into@niedermann.it
).
I already found a couple of suspicious things while investigating this issue, I just can't proof it for now. Thanks for leading us to this! I hope I can dive deeper into this and get a clearer view of where the leaks exactly happen, but I'm already quite convinced that there are leaks. Not in our code though (we never make mistakes :stuck_out_tongue_winking_eye: ), but in a library we use.
Any logs from you would be helpful. Just to make sure: you installed the APK in my previous post, cleared data of the dev app, started gathering logs, started the app, imported until it died and then took the logs? I'm asking because even I get the violation output in the logs, without the app even crashing. If you did all that steps, it's fine too.
And one more question: do you have a few images attached to your cards?
Logcat file sent to Stefan!
Haha with pleasure! I hope you find the root cause :)
In your described sequence I missed the step of clearing the storage, my bad! :( I installed your Dev app that was previously uninstalled, started gathering the logs, connected the account inside the Android Deck app, then it died importing data. I waited few seconds more, then took the logs. If you want I will send you logs again tomorrow, ensuring I properly clear data before starting the app.
However from my previous tests on past days I confirm that this error systematically occurs, whether I delete data or not before connecting the account inside the app.
Image attacments: I don't have any "cover" images attached to my cards, but I do have heavy decks with many cards (I use the app a lot) and do have few files attached too (not many).
@TtuxX thanks for both logs! I'll dive into this, hopefully I can find some time this weekend.
Image attacments: I don't have any "cover" images attached to my cards, but I do have heavy decks with many cards (I use the app a lot) and do have few files attached too (not many).
Thats fine, so I can check that later on, doesn't seem to be this particular problem then.
@TtuxX sorry for the lack of communication lately.
Here is a footage of me during the last two weeks:
What I'm trying to say is that it still might take a while... I'll update you here as soon as there are some news
@desperateCoder Haha thank you very much for the update, I appreciate it! :)
I feel for you haha Digging into unexpected code issues often result into this kind of situation.
No worries, thank you so much again for your time and kind help! For now I can use the slow debug version that kinda works (except some unexpected crashes while opening some cards).
I hope you will be able to trace the origin of this bug without too much time and difficulty :)
Will be fixed in 1.20.1
- please reopen in case the error still happens with this or a higher version. Thanks everyone for testing and helping analysing this issue!
Hi there! :)
I hope the team is doing fine!
I am again having an SSO login issue and cannot login on version 1.23.4.
Sync never properly ends unfortunately
App Version: 1.23.4
App Version Code: 1023004
Server App Version: 1.11.0
App Flavor: fdroid
Files App Version Code: 30260090 (PROD)
Files App Version Code: 20231014 (DEV)
---
OS Version: 4.19.278-gbf451ea24640(2023101300)
OS API Level: 34
Device: redfin
Manufacturer: Google
Model (and Product): Pixel 5 (redfin)
---
android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (code 787 SQLITE_CONSTRAINT_FOREIGNKEY)
at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:961)
at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:790)
at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:89)
at androidx.sqlite.db.framework.FrameworkSQLiteStatement.executeInsert(FrameworkSQLiteStatement.kt:42)
at androidx.room.EntityInsertionAdapter.insertAndReturnId(EntityInsertionAdapter.kt:102)
at it.niedermann.nextcloud.deck.database.dao.CommentDao_Impl.insert(CommentDao_Impl.java:221)
at it.niedermann.nextcloud.deck.database.dao.CommentDao_Impl.insert(CommentDao_Impl.java:31)
at it.niedermann.nextcloud.deck.database.DataBaseAdapter.createComment(DataBaseAdapter.java:1152)
at it.niedermann.nextcloud.deck.remote.helpers.providers.DeckCommentsDataProvider.createInDB(DeckCommentsDataProvider.java:81)
at it.niedermann.nextcloud.deck.remote.helpers.providers.DeckCommentsDataProvider.createInDB(DeckCommentsDataProvider.java:21)
at it.niedermann.nextcloud.deck.remote.helpers.SyncHelper$1.onResponse(SyncHelper.java:62)
at it.niedermann.nextcloud.deck.remote.helpers.SyncHelper$1.onResponse(SyncHelper.java:47)
at it.niedermann.nextcloud.deck.remote.helpers.providers.DeckCommentsDataProvider$1.onResponse(DeckCommentsDataProvider.java:41)
at it.niedermann.nextcloud.deck.remote.helpers.providers.DeckCommentsDataProvider$1.onResponse(DeckCommentsDataProvider.java:32)
at it.niedermann.nextcloud.deck.remote.api.RequestHelper$ResponseConsumer.accept(RequestHelper.java:52)
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$0$com-nextcloud-android-sso-api-NextcloudAPI(NextcloudAPI.java:123)
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:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
@TtuxX your recent issue is unrelated to both, this issue and the SSO login mechanism. It's a duplicate of https://github.com/stefan-niedermann/nextcloud-deck/issues/1447 please follow the discussion there 👋 It's a race condition. As a workaround try clearing the storage of Deck Android as described in the FAQ ans try to login - repeat this multiple times until it works (ör we find the actual root cause)
Wooops, sorry for this and thanks for the link !! I tried many times force-stopping, erasing data and importing again but it never worked. Either crashed during the process or stalled at 37/39 boards without ever finishing.
Seeing the "Cursor window allocation of 2048 kb failed" error in 1.24.1 from fdroid. Rolling back to 1.23.4 fixed it.
Huawei MediaPad M5 lite 10 running Android/EMUI 8. Didn't see the same issue on my phone, running Android 13.
Hi there @stefan-niedermann and @desperateCoder ! :)
I hope you are doing fine and I wish you a Happy New Year !! :)
I am publishing this issue again (mentioned in my comment on issue https://github.com/stefan-niedermann/nextcloud-deck/issues/1117) as Deck app has not worked for me since the end of septembre 2021 and I miss it a lot for my day-to-day organisation!
Describe the bug
The Deck app crashes when trying to connect the app for the first time after clearing app data.
The app throws an error related to something like "too many open files", then the error window pops-up (hiding the message), with one of the two error messages listed in this bug report's stacktrace section.
Steps to reproduce the behavior:
Expected behavior
All the data is imported and the app works as expected.
Versions
Smartphone (please complete the following information):
Stacktrace
Thank you very much in advance to you both for your kind help ! :)