dmfs/opentasks

FC when opening task via Todo Agenda

milaq opened this issue · 6 comments

milaq commented

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 (ea88dc0) is the culprit.
Also unsure whether this is an issue with Todo Agenda or not.

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

dmfs commented

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.

milaq commented

Awesome, thanks for your fast reply and problem analysis.

@dmfs Hi,

It seems I'm experiencing the same issue in this thread:
#1034

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

Regards,

yvolk commented

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?

milaq commented

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

As this bug breaks OpenTasks pretty badly, maybe a quick revert of ea88dc0 (until fixed) would it usable again?

reverting ea88dc0 works