1

Completed tasks replay when TaskService is restarted if the task was started following a long running task

Tasks that are running when the TaskService is killed are resumed when the TaskService can be recreated (as they should).  In addition completed tasks that should not resume are incorrectly replayed if they were started after a task which should resume.

Example:

  • Task "Long" requires a long time to finish.
  • Task "Short1" and "Short2" are done quickly.
  • User starts tasks in the order Short2, Long, Short1.
  • Tasker finishes Short2 and Short1 but is still working on Long.
  • Android terminates the TaskService
  • Tasker recreates TaskService
  • Tasker resumes Long and Short1 even though Short1 had already finished.

Expected behavior: Tasker resumes Long only.

I've attached an XML of a project that reproduces the bug and a run log showing the incorrect replays.

The demo contains three tasks and a scene.  The task Forever waits in a loop forever.  The task Short flashes the running tasks.  Start shows the scene which has one button that runs Short.  To simulate an Android kill (OOM) the scene can be cleared out of the recent apps list.

To run the demo start Forever, then run Start and press the button a few times to complete some short tasks.  Then clear the scene from the recent apps list to simulate an Android kill.  After a short delay Tasker will resume Forever (correctly) and also (incorrectly) run Start, showing the scene, and attempt to run Short several times.

Bug observed on Samsung Galaxy S4 running Android 5.0.1 and Tasker 5.5.bf2

3 replies

S

The issue may also effect MonitorStart event ordering.  When the Monitor restarts tasks associated with a MonitorStart event profile do not run first (before resumed tasks).  It's not clear if this is a bug or not since MonitorStart event documentation seems to assume that the event will only happen before any other tasks could be running.

Also tasks from a max priority MonitorStart event profile do not take precedence over resumed tasks.

I will attach another run log showing the placement of MonitorStart event tasks.  Priority of the profile is 50.

S

I can't seem to post another file.  The log is very straightforward showing (in order) the Monitor start, then Task Service start, then resumed tasks (including those that were already finished), then the MonitorStart event profile task.

Let me know if the log or an updated bug demo XML (including MonitorStart profile) would be helpful.

S

Typically it would be out-of-memory killer (ie. I started a resource heavy app) but the issue occurs without regard to the reason, hence being able to demo it with the recent apps list.

Thank you for the clarification

Thank you for the report.

Can you tell me why exactly Android is terminating the service? Do you know?