opentasks icon indicating copy to clipboard operation
opentasks copied to clipboard

FC when opening task via Todo Agenda

Open milaq opened this issue 4 years ago • 6 comments

When selecting a task via a Todo Agenda widget OpenTasks FCs with the following trace:

03-19 17:03:57.741 31507 31772 E AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
03-19 17:03:57.741 31507 31772 E AndroidRuntime: Process: org.dmfs.tasks, PID: 31507
03-19 17:03:57.741 31507 31772 E AndroidRuntime: java.lang.RuntimeException: An error occurred while executing doInBackground()
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at android.os.AsyncTask$3.done(AsyncTask.java:354)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at java.util.concurrent.FutureTask.run(FutureTask.java:271)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at java.lang.Thread.run(Thread.java:764)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: Caused by: android.database.sqlite.SQLiteException: no such column: is_recurring (code 1 SQLITE_ERROR): , while compiling: SELECT account_type, account_name, title, location, description, geo, url, tz, duration, list_name, rrule, rdate, priority, list_color, task_color, status, class, percent_complete, is_allday, is_closed, pinned, is_recurring, list_id, dtstart, due, completed, _id, original_instance_id, task_id FROM Task_View WHERE ( 1=1  AND _id=34 AND _deleted=0) ORDER BY due
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:903)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:514)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:46)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1408)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:549)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:420)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at org.dmfs.provider.tasks.TaskProvider.query(TaskProvider.java:62)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at android.content.ContentProvider.query(ContentProvider.java:1057)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at android.content.ContentProvider.query(ContentProvider.java:1149)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at android.content.ContentProvider$Transport.query(ContentProvider.java:241)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at android.content.ContentResolver.query(ContentResolver.java:804)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at android.content.ContentResolver.query(ContentResolver.java:753)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at android.content.ContentResolver.query(ContentResolver.java:711)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at org.dmfs.tasks.utils.AsyncContentLoader.doInBackground(AsyncContentLoader.java:7)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at org.dmfs.tasks.utils.AsyncContentLoader.doInBackground(AsyncContentLoader.java:1)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at android.os.AsyncTask$2.call(AsyncTask.java:333)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
03-19 17:03:57.741 31507 31772 E AndroidRuntime: 	... 4 more

SQLiteException because the db is missing an is_recurring column. This also happens with tasks that were created with the new version and have a recurrance set.

Haven't looked at the code but assuming that the recent change (https://github.com/dmfs/opentasks/commit/ea88dc0396bbe1da2907519eb2a4e6167f4cacdd) is the culprit. Also unsure whether this is an issue with Todo Agenda or not.

P.S.: Thanks for the solid work btw! :1st_place_medal: OpenTasks has become an inherent part of my daily workflow. Chapeau!

milaq avatar Mar 19 '21 16:03 milaq

Thanks for the report. I think I know where this comes from. At present the details view supports only entries of the task instances table. Todo Agenda should switch to use the Instances Table as well to support recurring tasks properly. At present it doesn't make much of a difference (except for this crash, of course) but once we start expanding future instances it will make a difference.

I'll provide a fix for this.

dmfs avatar Mar 19 '21 20:03 dmfs

Awesome, thanks for your fast reply and problem analysis.

milaq avatar Mar 20 '21 14:03 milaq

@dmfs Hi,

It seems I'm experiencing the same issue in this thread: https://github.com/dmfs/opentasks/issues/1034

However, I did not find any way to provide logs, if it can help I'm willing to give them.

Regards,

uSyzex avatar May 31 '21 19:05 uSyzex

Ok, so we see that a change in the OpenTasks app broke interface (contract) with widgets and as a result we have OpenTasks' crash and no data from it in ToDo Agenda widget.

Normal solution of this problem should be allowing OpenTasks to process "the old way" requests correctly to preserve compatibility: users not always want to update both apps simultaneously, so this fix will allow to update OpenTasks app without updating the widget. At least OpenTasks should not crash, but instead should tell a User that it's not compatible with a widget anymore... to avoid users' confusion and disappointment.

@dmfs Do you agree?

yvolk avatar Jun 01 '21 05:06 yvolk

@dmfs Did you have time to take a look at it?

As this bug breaks OpenTasks pretty badly, maybe a quick revert of https://github.com/dmfs/opentasks/commit/ea88dc0396bbe1da2907519eb2a4e6167f4cacdd (until fixed) would it usable again?

milaq avatar Aug 15 '21 22:08 milaq

reverting https://github.com/dmfs/opentasks/commit/ea88dc0396bbe1da2907519eb2a4e6167f4cacdd works

symphorien avatar Jun 25 '22 14:06 symphorien