readrops / Readrops

Android multi-services RSS client
GNU General Public License v3.0
272 stars 20 forks source link

`FOREIGN KEY constraint failed` when pulling down to refresh #80

Open shunf4 opened 3 years ago

shunf4 commented 3 years ago

When I pull down to refresh in article list, a snackbar pop out saying "android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (Sqlite code 787 SQLITE_CONSTRAINT_FOREIGNKEY), (OS error - 11:Try again)", and no updates are retrieved.

Here's the stack trace:

10-23 12:52:59.817 22263 22263 W System.err: android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (Sqlite code 787 SQLITE_CONSTRAINT_FOREIGNKEY), (OS error - 11:Try again)
10-23 12:52:59.818 22263 22263 W System.err:    at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
10-23 12:52:59.818 22263 22263 W System.err:    at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:841)
10-23 12:52:59.818 22263 22263 W System.err:    at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:803)
10-23 12:52:59.818 22263 22263 W System.err:    at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:86)
10-23 12:52:59.818 22263 22263 W System.err:    at e.p.a.h.e.executeInsert(Unknown Source:2)
10-23 12:52:59.818 22263 22263 W System.err:    at androidx.room.d.j(Unknown Source:31)
10-23 12:52:59.818 22263 22263 W System.err:    at com.readrops.db.g.i.o(Unknown Source:12)
10-23 12:52:59.818 22263 22263 W System.err:    at com.readrops.app.f.h0.D(Unknown Source:100)
10-23 12:52:59.818 22263 22263 W System.err:    at com.readrops.app.f.h0.M(Unknown Source:40)
10-23 12:52:59.818 22263 22263 W System.err:    at com.readrops.app.f.n.a(Unknown Source:11)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.c.a$a.e(Unknown Source:2)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.e.d$a$a.e(Unknown Source:2)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.d.e.e(Unknown Source:2)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.e.d$a$a.e(Unknown Source:2)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.e.g.l(Unknown Source:9)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.p.a(Unknown Source:14)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.e.d$a.e(Unknown Source:26)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.e.d$a$a.e(Unknown Source:2)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.d.h$a.b(Unknown Source:21)
10-23 12:52:59.818 22263 22263 W System.err:    at m.z.a.a$a.b(Unknown Source:6)
10-23 12:52:59.818 22263 22263 W System.err:    at m.z.a.c.n(Unknown Source:42)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.j.a(Unknown Source:14)
10-23 12:52:59.818 22263 22263 W System.err:    at m.z.a.a.n(Unknown Source:7)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.j.a(Unknown Source:14)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.d.h.l(Unknown Source:9)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.p.a(Unknown Source:14)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.e.d$a.e(Unknown Source:26)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.e.d$a$a.e(Unknown Source:2)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.d.h$a.b(Unknown Source:21)
10-23 12:52:59.818 22263 22263 W System.err:    at m.z.a.a$a.b(Unknown Source:6)
10-23 12:52:59.818 22263 22263 W System.err:    at m.z.a.c.n(Unknown Source:42)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.j.a(Unknown Source:14)
10-23 12:52:59.818 22263 22263 W System.err:    at m.z.a.a.n(Unknown Source:7)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.j.a(Unknown Source:14)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.d.h.l(Unknown Source:9)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.p.a(Unknown Source:14)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.e.d$a.e(Unknown Source:26)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.d.h$a.b(Unknown Source:21)
10-23 12:52:59.818 22263 22263 W System.err:    at m.z.a.a$a.b(Unknown Source:6)
10-23 12:52:59.818 22263 22263 W System.err:    at m.z.a.c.n(Unknown Source:42)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.j.a(Unknown Source:14)
10-23 12:52:59.818 22263 22263 W System.err:    at m.z.a.a.n(Unknown Source:7)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.j.a(Unknown Source:14)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.d.h.l(Unknown Source:9)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.p.a(Unknown Source:14)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.e.d.l(Unknown Source:9)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.p.a(Unknown Source:14)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.e.d.l(Unknown Source:9)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.p.a(Unknown Source:14)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.e.d.l(Unknown Source:9)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.p.a(Unknown Source:14)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.e.b$a.b(Unknown Source:9)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.a.a$a.b(Unknown Source:2)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.a.c.a(Unknown Source:5)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.a.d.q(Unknown Source:0)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.b.a(Unknown Source:14)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.a.a$b.b(Unknown Source:9)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.d.e$a.b(Unknown Source:2)
10-23 12:52:59.818 22263 22263 W System.err:    at m.z.a.a$a.b(Unknown Source:6)
10-23 12:52:59.818 22263 22263 W System.err:    at m.z.a.c.n(Unknown Source:42)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.j.a(Unknown Source:14)
10-23 12:52:59.818 22263 22263 W System.err:    at m.z.a.a.n(Unknown Source:7)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.j.a(Unknown Source:14)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.d.e.q(Unknown Source:7)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.b.a(Unknown Source:14)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.a.a.q(Unknown Source:9)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.b.a(Unknown Source:14)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.y.e.e.b.l(Unknown Source:9)
10-23 12:52:59.818 22263 22263 W System.err:    at g.a.p.a(Unknown Source:14)
10-23 12:52:59.819 22263 22263 W System.err:    at g.a.y.e.e.d$a.e(Unknown Source:26)
10-23 12:52:59.819 22263 22263 W System.err:    at g.a.y.e.e.a$a.e(Unknown Source:35)
10-23 12:52:59.819 22263 22263 W System.err:    at com.readrops.app.f.h0.K(Unknown Source:38)
10-23 12:52:59.819 22263 22263 W System.err:    at com.readrops.app.f.k.a(Unknown Source:4)
10-23 12:52:59.819 22263 22263 W System.err:    at g.a.y.e.e.a.l(Unknown Source:10)
10-23 12:52:59.819 22263 22263 W System.err:    at g.a.p.a(Unknown Source:14)
10-23 12:52:59.819 22263 22263 W System.err:    at g.a.y.e.e.d.l(Unknown Source:9)
10-23 12:52:59.819 22263 22263 W System.err:    at g.a.p.a(Unknown Source:14)
10-23 12:52:59.819 22263 22263 W System.err:    at g.a.y.e.c.a.n(Unknown Source:12)
10-23 12:52:59.819 22263 22263 W System.err:    at g.a.j.a(Unknown Source:14)
10-23 12:52:59.819 22263 22263 W System.err:    at g.a.y.e.d.i$b.run(Unknown Source:6)
10-23 12:52:59.819 22263 22263 W System.err:    at g.a.o$a.run(Unknown Source:9)
10-23 12:52:59.819 22263 22263 W System.err:    at g.a.y.g.h.run(Unknown Source:13)
10-23 12:52:59.819 22263 22263 W System.err:    at g.a.y.g.h.call(Unknown Source:0)
10-23 12:52:59.819 22263 22263 W System.err:    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
10-23 12:52:59.819 22263 22263 W System.err:    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
10-23 12:52:59.819 22263 22263 W System.err:    at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
10-23 12:52:59.819 22263 22263 W System.err:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
10-23 12:52:59.819 22263 22263 W System.err:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
10-23 12:52:59.819 22263 22263 W System.err:    at java.lang.Thread.run(Thread.java:784)
Shinokuni commented 3 years ago

Thanks for reporting the issue, seems that an id is missing somewhere, but with Proguard the stacktrace will be difficult to analyze.

Could you tell me which account are you using?

shunf4 commented 3 years ago

@Shinokuni I'm using a self-hosted FreshRSS instance on an unrooted device, and after removing and re-adding the account I haven't come across this issue yet. So unfortunately I am unable to provide more detailed information(?)

Shinokuni commented 3 years ago

Thanks for the account type, and don't worry, I will see what I can do to fix this. I remembered that I could de-obfuscate the stack-trace but strangely, it didn't work.

alex-mazzariol commented 3 years ago

I've been having this issue too, with a self-hosted FreshRSS instance version 1.15.4-dev and Readrops versions 1.1.4 and 1.2.0 - I actually hoped that the 1.2.0 somehow addressed this issue, but it is still present.

Once the issue begins, there does not seem to be any way of recovering operations; i.e. reducing the maximum number of kept items per feed to the minimum does not appear to do anything, and synchronization does not complete anymore. The only way to use the app again is to clear all data and reconfigure the account.

This issue also does not seem to be related to other crashes of the app, where it gets completely closed by the system and needs to be restarted manually.

Shinokuni commented 3 years ago

When the issue appears, are you able to reproduce every time you synchronize? I didn't succeed to reproduce but I fixed something unrelated which could fix this issue too.

alex-mazzariol commented 3 years ago

Yes, every attempt fails.

Shinokuni commented 3 years ago

Okay, this is consistent.

If it happens when you synchronize for the first time, could you test this debug build (fully okay if you don't want to)? Because I think I fixed this issue, but without being able to reproduce, it's hard to be sure. You won't have to uninstall the release version, it will be installed next to it. It's an unstable build but you should be able to synchronize.

alex-mazzariol commented 3 years ago

To be very pedantic, it does not happen when I synchronize for the first time, but a random amount of days after I configure and successfully use/sync the FreshRSS account. Once it begins happening, it then keeps happening for every sync attempt.

I believe that since the two apps won't share the same database I don't think the issue will be any clearer with your debug build, unless I actually configure and normally use it too. Later today I will download, compile and try running a readrops debug installation from android studio as my main readrops app, so that I can properly debug the issue should it arise again.

shunf4 commented 3 years ago

I believe this issue is fixed in commit cfa764e78bfd6120f25932b1c48975b80cbf1ce2, for now items that exist on device(thus with uninitialized feedId) is no longer inserted into the database. See below:

https://github.com/readrops/Readrops/commit/cfa764e78bfd6120f25932b1c48975b80cbf1ce2#diff-b37765f42b5ae2d26f91ed6a781e02759b28365d252f06ac99320846a2ecf157L232

Shinokuni commented 3 years ago

Yes, I was thinking about this, but as I wasn't able to reproduce...

alex-mazzariol commented 3 years ago

After more than one month of daily usage of the debug version of Readrops 1.2.0 (the one that used to have the random FOREIGN KEY constraint failed error), I could not reproduce the problem and investigate further. The FreshRSS instance was not updated, to help keep the context coherent.

On the basis of the comment from @shunf4 I'll remove the debug version and upgrade to 1.2.1 from FDroid, will give feedback on the issue in about a month. I believe that if the problem does not happen again within a month the issue can be closed.

Shinokuni commented 3 years ago

Thank you for testing this, hoping for good news.