Question about enter and exit tasks and how they run.

58 views
Skip to first unread message

Jakke Velo

unread,
Jan 5, 2019, 10:01:56 AM1/5/19
to Tasker
I have a profile on which the enter tasks sometimes runs but the exit doesn't.
(i've posted this here before but can't find it directly and this was marked solved because after a reboot it worked well for a while)
The profile is quite simple:
It detects if certain celltowers are present and then enters the enter task in which a few variables are set.
One of these variables then triggers another profile to start Location Service (it used to be all in one enter task but it was easier to follow when seperated).
If the phones loses all of the dedicated cell towers, it should fire the exit task.
The exit task resets the same variables and this then triggers the Location Service profile to stop the service.

But sometimes this doesn't 100% work.

I had a suspicion that the enter task ran more then the exit task.
For this to be tested i first added a variable named count which i counted up when the enter task was executed and counted down when the exit task was executed.
If the profile was not active, the counter should always have showed 0 as value (both enter and exit tasks ran the same number of times). This was not always the case.

I then replaced the count variable with an enter variable when the enter task was ran and an exit variable when the exit tasks had run.
The variable result should have both variables give the same number of counts after the profile got inactive.
This again is not always the case.

For the moment, the enter task ran 164 times, the exit task 161 times but the profile is still active so when it goes inactive,
the exit variable will count one up to 162 but instead it should show 164 if all worked well.
This means that over the last couple of days, the enter task ran 2 times more then the exit task.

I know an enter task has a higher priority then an exit task.

I would like to know what happens when:
- 1: A profile gets inactive when the enter task still runs (i assume that the exit task will run as soon as the enter task has finished)?
- 2: When a profile gets active, then enter task runs and while running the profile switches from active to not active and back to active again in the timespan the enter task runs... what happens then?
      Does the enter task run twice without the exit task or does the second trigger of the profile prevents the exit task from running since the next task has a higher priority?


Jakke Velo

unread,
Jan 5, 2019, 10:07:13 AM1/5/19
to Tasker
Or does it have to with the Maximum Tasks Queued setting (currently set to standard 10)?

João Dias

unread,
Jan 8, 2019, 7:49:01 AM1/8/19
to tas...@googlegroups.com
Maybe you rebooted your device which made the exit task not run and the exit task run more than expected? :)

Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias


--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.

Jakke Velo

unread,
Jan 9, 2019, 1:44:21 PM1/9/19
to Tasker
No that's not the case.

I did some testruns with a another (simple) profile which only activates on a variable state.
The Enter task has a 60 sec wait in it so i can play around a bit with the variable value while the enter task is running to what happens on certain changes.
It always works fine, whatever i try.

But the the profile to detect certain cell towers has a glitch.
There my enter task performs sometimes a few times more then the exit task.
I already suspected this and put in some spy variables in both enter and exit task to see what happens.
And believe it or not, the enter task performs a few times (2 to 3) more then the exit task in around +/- 500 triggers.
The enter and exit tasks for this profile are nothing complex, just a few variables (which actually trigger other profiles which do the actual work) and one Wifi On in the enter task and one Wifi off and disconnect in the exit.
I'm thinking about separating the Wifi triggers out of both tasks so they are clean and only set/reset variables but i'm also sure that that is not the solution.

Rich D

unread,
Jan 10, 2019, 5:11:46 AM1/10/19
to Tasker Google Groups Post

But the the profile to detect certain cell towers has a glitch.
There my enter task performs sometimes a few times more then the exit task.
I already suspected this and put in some spy variables in both enter and exit task to see what happens.

To properly troubleshoot this I would turn on the run log (menu/ more / run log ) then instead of setting variable in the tasks use the Action ->. File-> Write file : File: Test_log.txt

Use the same file in both the enter and exit tasks. In the enter task write 

Enter   - %DATE    -  %TIME

And in the exit task write

Exit   - %DATE    -  %TIME  <2 carriage returns>


So you text file will look like this

Enter  date and time
Exit     date and time

Enter date and time
Exit   date and time



You can then easily find the times of the issue and check the run log to see why the flow is not as expected. 

There is a section in the user guide that explains the run log. If you need help with the interpretation of the run log you can post a screen shot here. 



Rich D

unread,
Jan 10, 2019, 5:26:28 AM1/10/19
to Tasker Google Groups Post
My suspension is tasker is being killed while the task is active. If this is the case you will see a "monitor start"  in the run log in between activations.

Note- "monitor restart" is a normal thing to see in the run log. That is just tasker updating the monitor.  

Rich D

unread,
Jan 10, 2019, 5:38:18 AM1/10/19
to Tasker Google Groups Post


To properly troubleshoot this I would turn on the run log (menu/ more / run log ) then instead of setting variable in the tasks use the Action ->. File-> Write file : File: Test_log.txt


Also be sure to tick the 'append' option in the 'write file' action..  

Jakke Velo

unread,
Jan 14, 2019, 1:08:45 AM1/14/19
to Tasker
Should i place the File Write action at the start or at the end of the tasks?
Because, if it's at the start, the run log is written before the task end, if i add it at the end, it might never be written since the task might not be completed.
Or do i see this wrong?

Also, what might kill Tasker in the first place? It's not battery optimized.
And if it's getting killed, what makes it run again without my interference?

Rich D

unread,
Jan 14, 2019, 4:31:08 AM1/14/19
to Tasker Google Groups Post

Should i place the File Write action at the start or at the end of the tasks?
Because, if it's at the start, the run log is written before the task end,



if i add it at the end, it might never be written since the task might not be completed.

That is what we want to happen, because the enter task "needs" to finish before the exit task will run. So if you see 2 consecutive iterations of the exit task in your log file that is the time frame you should check the run log for. So the end of the tasks is where I would place it. 


Also, what might kill Tasker in the first place?

Android. 


It's not battery optimized.

There are other reasons android might kill the process. Such as low memory

And if it's getting killed, what makes it run again without my interference?

Tasker is one of those apps that will start itself (for lack of better terms) after being killed.



Jakke Velo

unread,
Jan 18, 2019, 10:16:15 AM1/18/19
to Tasker
Did what you suggested.
Weird thing is that i now have the opposite of what i used to have.

I had: enter task performed more then exit task (counted via variables in each task, when they didn't match anymore some sequence went wrong).
In all of the previous cases, after some time had passed (could be some days even), the Enter counter was 1 or 2 higher then the Exit counter.

I now have: exit task performed more then enter task (i left the counters in each task when i added the log because it's quicker to see if something went wrong).

Example:
Today i had this:
Enter: 18-01-19 - 14:27
Exit: 18-01-19 -14:31
Enter: 18-01-19 -14:31
Exit: 18-01-19 -14:32
Enter: 18-01-19 -14:32
Exit: 18-01-19 -14:32 !!!!!
Exit: 18-01-19 -14:36 !!!!!
Enter: 18-01-19 -14:37

There no Enter task after the Exit at 14:32 and it Exit's again at 14:36

I wonder how that is possible, even if Android would kill the Tasker process, there should be an Enter Task first.

Rich D

unread,
Jan 18, 2019, 1:03:33 PM1/18/19
to Tasker Google Groups Post
This is where the run log comes in. Post section of the run log for the time in question where you have the double exit tasks. usually just a screenshot or two of the run log is fine,  And post all relevant profile and task "descriptions". 



To post your profile or task here...  Long press on the profile or task name / ( 3 dot menu with 4.0+ ) export / export "DESCRIPTION" to clipboard (not XML)

Any linked tasks will be exported with the profile they are linked to..

To be able to export, The beginner mode needs to be off and the profile needs to be named by you (Not the Tasker listed name.  Tasker will list your profile with the context name if you have not given it one).






Jakke Velo

unread,
Jan 19, 2019, 10:19:02 AM1/19/19
to Tasker
LOL, Run log wasn't turned on. Did so now, back to square one for the moment, waiting for it to happen again.
Reply all
Reply to author
Forward
0 new messages