federicoiosue / Omni-Notes

Open source note-taking application for Android
https://omninotes.app
GNU General Public License v3.0
2.68k stars 1.11k forks source link

Corrupted note crashes app #828

Closed echeoquehaii closed 3 years ago

echeoquehaii commented 3 years ago

Hi @federicoiosue ! Today I encountered a little issue and can't figure out how to fix it. I was exporting a WhatsApp chat and Android gave me the option to save all the files as a note in Omni Notes. It was not many files, around 10. So the note was created but then the app crashed and it's crashing anytime I try to open it again. I imagine it would be possible to fix this by manually editing the database to remove such note, but I'm not sure it would be enough neither how to do it.

Could you give me a hand with this? Thanks!

federicoiosue commented 3 years ago

Hi there!

Which version of the app are you using? You could eventually turn on the Settings->Privacy->Save logs to file option to check if something usefull can be taken from it!

I tried myself to share a chat to ON (media included) and it worked: what I got was a new note with both media (12 files) and a text file containing the text.

echeoquehaii commented 3 years ago

Oh weird then! I'm on 6.0.5, and I cannot enable log since the app just crashes as soon as I open it. It sends a message nevertheless that it is sending a log to the developer (you).

Anyway I don't really care about the exported chat, but I would like to recover the old notes

federicoiosue commented 3 years ago

Which is your exact device model?

echeoquehaii commented 3 years ago

Which is your exact device model?

I have a Samsung Galaxy S7, SM-G930F

echeoquehaii commented 3 years ago

Sorry for bothering, any hints on this?

federicoiosue commented 3 years ago

I'm digging into crash reports but they're aggregated for privacy and it's quite hard to get a specific device's analysis. OS version? would you mind replicating the issue to let the app sending another report so that I can have an exact "last occurrence" date?

echeoquehaii commented 3 years ago

No worries, I just thought you might have imagined I was not interested anymore. Sorry! I'm on Lineage OS 18.1 microg version, Android 11. Actually the app is sending reports many times a day, or at least I get the message. Maybe it's because I'm using the widget, so it tries to load in the background, even if I don't actively open the app. I will do it again just now, 3 times in a row, I hope it helps recognising the log. If there was a way to edit the db manually I could try, I actually did with a normal text editor but it didn't help, I imagine there's something else causing the crash.

federicoiosue commented 3 years ago

Maybe this could be useful too https://play.google.com/store/apps/details?id=com.dp.logcatapp

Because I'm trying to find the crash report but I really don't know what could be the cause actually

federicoiosue commented 3 years ago

What about if you remove the widget from home?

echeoquehaii commented 3 years ago

What about if you remove the widget from home?

Yes, I tried but it didn't help

Maybe this could be useful too https://play.google.com/store/apps/details?id=com.dp.logcatapp

Ahh nice, here's the log! I've used the F-Droid version, I guess it's the same. logcat_06-21-2021_16-01-33.txt I hope it's useful, thank you so much for your help anyway!

federicoiosue commented 3 years ago

cmp=it.feio.android.omninotes/.widget.ListWidgetService (has extras) }: android.database.sqlite.SQLiteException: not an error (code 0 SQLITE_OK): Could not open the database in read/write mode.

This is related to home widget, having removed it this error should not appear anymore

java.lang.IllegalArgumentException: No such service ComponentInfo{it.feio.android.omninotes/org.acra.sender.SenderService} at android.os.Parcel.createExceptionOrNull(Parcel.java:2377)

This is related to the third party crash report library, I'd ignore it, I don't think it would cause issues

[06-21 15:46:25.541 3824:13429 I/ActivityTaskManager] START u0 {cmp=it.feio.android.omninotes/.intro.IntroActivity} from uid 10165 [06-21 15:46:25.643 26559:26585 E/AndroidRuntime] FATAL EXCEPTION: AsyncTask #1 Process: it.feio.android.omninotes, PID: 26559 java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$4.done(AsyncTask.java:415) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383) at java.util.concurrent.FutureTask.setException(FutureTask.java:252) at java.util.concurrent.FutureTask.run(FutureTask.java:271) 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:923) Caused by: it.feio.android.omninotes.exceptions.NotesLoadingException: Error retrieving notes at it.feio.android.omninotes.async.notes.NoteLoaderTask.doInBackground(NoteLoaderTask.java:77) at it.feio.android.omninotes.async.notes.NoteLoaderTask.doInBackground(NoteLoaderTask.java:30) at android.os.AsyncTask$3.call(AsyncTask.java:394) at java.util.concurrent.FutureTask.run(FutureTask.java:266) ... 3 more Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invoke(Native Method) at it.feio.android.omninotes.async.notes.NoteLoaderTask.doInBackground(NoteLoaderTask.java:75) ... 6 more Caused by: android.database.sqlite.SQLiteException: not an error (code 0 SQLITE_OK): Could not open the database in read/write mode. at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method) at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:224) at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:205) at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:505) at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:206) at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:198) at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:918) at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:898) at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:762) at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:751) at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:383) at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:340) at it.feio.android.omninotes.db.DbHelper.getDatabase(DbHelper.java:152) at it.feio.android.omninotes.db.DbHelper.getDatabase(DbHelper.java:147) at it.feio.android.omninotes.db.DbHelper.getNotes(DbHelper.java:426) at it.feio.android.omninotes.db.DbHelper.getNotesActive(DbHelper.java:342) at it.feio.android.omninotes.db.DbHelper.getAllNotes(DbHelper.java:319)

This seems to be the real problem but it's so specific that I've not been able to reproduce. You could:

  1. Add the following row to the app's settings at _/data/data/it.feio.android.omninotes/shared_prefs/it.feio.android.omninotespreferences.xml to skip that section (but you have to gain root access):

    <boolean name="pref_tour_complete" value="true" />
  2. Try to upgrade to the 6.1.0 Beta 2 and check if that solves

echeoquehaii commented 3 years ago

Add the following row to the app's settings at /data/data/it.feio.android.omninotes/shared_prefs/it.feio.android.omninotes_preferences.xml to skip that section (but you have to gain root access):

Tried but it didn't work. If that setting refers to the "welcome screen", it was actually starting because I had tried to clear all data of the app to see if it could help. I attach the log after changing the pref_tour boolean, in case now it has more useful information. logcat_06-23-2021_13-34-09.txt

Try to upgrade to the 6.1.0 Beta 2 and check if that solves

I cannot seem to find it! In Play Store there's only the alpha version, and here only the stable...

Thank you again so much @federicoiosue !

EDIT: in the alpha version 6.1.0, after copying the database file (omni-notes), it crashes too.

federicoiosue commented 3 years ago

You should opt-in before being able to download beta releases: link

federicoiosue commented 3 years ago

Moreover, I noticed just now that the second log is about Omni Notes download from F-Droid, that should be a very different version!

echeoquehaii commented 3 years ago

Hi @federicoiosue! Yes, I usually download apps from F-Droid, what do you mean that it should be a different version?

federicoiosue commented 3 years ago

If you're on 6.0.5 then you must have downloaded from play store because the latest version on F-Droid is currently 5.5.2.

The former can be upgraded to latest 6.1.0 beta 2 from opt-in into play store. The latter can't be upgraded right now!

echeoquehaii commented 3 years ago

If you're on 6.0.5 then you must have downloaded from play store because the latest version on F-Droid is currently 5.5.2.

The former can be upgraded to latest 6.1.0 beta 2 from opt-in into play store. The latter can't be upgraded right now!

Sorry, no I just remembered, I think I was using the apk release from github, since the F-droid version wasn't getting updated. EDIT: So, I managed to install the beta version, is still crashing though with the "corrupted" database, I attach the log.

logcat_06-24-2021_20-38-55.txt

federicoiosue commented 3 years ago

Ok, same error, it could depend on database file permissions, These are permissions on my device. Screenshot_20210625-005146630 (1)

I've no more ideas once done this

echeoquehaii commented 3 years ago

Hi @federicoiosue ! I've tried that too but with no luck. Nevertheless I could open the database with a text editor and I found the most important notes I wanted to save. They were around 35, so with copy-paste and some time I was able to rewrite them again in a fresh Omni-Notes install. I'm sorry to have wasted your time! I thought it could have been easier to fix but apparently not. I will do backups more often from now on! Thank you again for your work, it's the best Open Source notes app by far since many years!