OpenArchive / Save-app-android-old

This is the Save app for Android
https://open-archive.org
GNU General Public License v3.0
94 stars 26 forks source link

app crashes when uploading video #522

Closed losalim closed 8 months ago

losalim commented 8 months ago

Describe the bug Tried to upload 29-second video with no metadata and not flagged as significant content. app crashed three times. Now, the video won't upload and causes the app to crash every time it re-opens. needs to uninstall and reinstall to use the app again.

Expected behavior Video uploads without causing app to crash

Environment (please complete the following information):

losalim commented 8 months ago

@vanichitkara would you mind testing to see if you have this issue too with longer videos

losalim commented 8 months ago

tested a few more times. app crash count 7

vanichitkara commented 8 months ago

The app crashed for me as well while uploading a 10-second-long video. But after crashing when I reopened the app again, the video got uploaded after some time @losalim @foundscapes OS version: Android v13.0 Device: OnePlus 11R 5G App Version 0.3.0-beta7

uniqx commented 8 months ago

I've started debugging this, but couldn't reproduce a crash yet.

I didn't observe anything noteworthy on android 11. I also tried on Android 14, in one of the many test uploads it did, one briefly flashed a ANR warning, however it vanished when the upload completed. Also the logs on Android 14 look different, there seems to be an additional layer of database logging on that version of Android. That's noteworthy because logcat got spammed with thousands of these lines:

2023-11-16 12:15:48.346  2009-3162  Sugar                   net...sharchive.openarchive.release  I  Media saved : 2
2023-11-16 12:15:48.347  2009-2009  SQL Log                 net...sharchive.openarchive.release  D  SQLiteQuery: SELECT * FROM MEDIA WHERE id=? LIMIT 1

So there seems to be some code doing massive amounts of database operations during upload. I'll keep investigating.

uniqx commented 8 months ago

It seems every progress update gets written to the database. (and read in the UI part of the code too) This is pretty bad because several hundred write permissions will have a severe toll on performance and I'm guessing here: might crash the app by overloading the system. I don't know if this is the actual problem, but it worth a shot fixing this issue and check if the problem persists.

uniqx commented 8 months ago

potentially fixed by 046cef8

foundscapes commented 8 months ago

@vanichitkara please test, ty!

vanichitkara commented 8 months ago

Working fine for me now! OS version: Android v13.0 Device: OnePlus 11R 5G App Version 0.3.0-beta7