• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule is executed repeatedly
#1
After adding some extra conditions to a rule, that rule got executed multiple times. When I switched the order of the conditions the rule behaved as expected again.


The rule below should be executed once if one of the states changes, but is executed repeatedly even without any change of state (until the sendmail action that is called, gets overrun and crashes with a segfault):
Code:
IF (achterdeurcontact.state IS on OR achterdeurcontact.state IS off) AND (vakantie.state IS on OR sun.sun IS set) THEN sendmail ....

This way the same rule works as it should, so is executed once on a state change:
Code:
IF (vakantie.state IS on OR sun.sun IS set) AND (achterdeurcontact.state IS on OR achterdeurcontact.state IS off) THEN sendmail ....

As you can see, the only difference is the order of both bracketed OR conditions in the rule.

So I got it working, but I think both versions of the rule should behave the same way.
 
Reply
#2
What does debug mode say?
 
Reply
#3
Debug mode told me that it was actually not one rule repeating, but several rules firing mail actions "at the same time", apparently causing smtp calls to be messed up".

If I test the same rules with my "write" (formerly called "file") action (so writing to a file instead of sending an email) the rules are working perfecly.

Conclusion, there is nothing wrong with the processing of the rules as such.Smile
 
Reply
#4
There are known issues within mail.c:

Error checking at line L347, L351, and L357 is only done for Error 451, 501, and 535 but in accordance to RFC2821 error handling should be the same for all 4xx and 5xx error codes.

The subject is discussed in more detail here.

I recommend to give those changes a try and report back.
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  [Solved] On and Off for one device in one rule Oliver 3 194 10-28-2019, 06:55 PM
Last Post: Oliver
  [solved] sunset rule doesn't work fleisch 4 184 10-26-2019, 07:05 AM
Last Post: fleisch
  Rule with&without device. One working not the other... Tamadite 9 1,093 07-24-2018, 08:55 AM
Last Post: curlymo
  rule executed once at start up segalion 3 616 07-12-2018, 05:28 PM
Last Post: curlymo
  Problem with executing bash script via rule/program dYna 1 902 02-15-2018, 09:06 PM
Last Post: dYna
  Rule Sunset works, Sunrise not apartmedia 1 1,066 12-05-2017, 07:09 PM
Last Post: apartmedia
  Problem with a Rule for a One Button Switch martin-dj 1 1,238 03-06-2017, 12:01 PM
Last Post: pilino1234
  Rule executed at wrong time philipp81 1 884 02-25-2017, 10:43 PM
Last Post: curlymo
  Rule with datetime will not work PT-Biker 4 2,593 09-24-2016, 11:57 AM
Last Post: PT-Biker
  Rule logging raj 1 1,298 09-05-2016, 01:35 PM
Last Post: raj

Forum Jump:


Browsing: 1 Guest(s)