• 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
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):
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:
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.
What does debug mode say?
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
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.

Possibly Related Threads...
Thread Author Replies Views Last Post
  Rule triggers twice Thorben653 13 915 02-05-2020, 01:06 PM
Last Post: VicktorKopf
  Exclude Weekend from a rule PT-Biker 1 422 12-08-2019, 10:22 AM
Last Post: curlymo
  [Solved] On and Off for one device in one rule Oliver 3 446 10-28-2019, 06:55 PM
Last Post: Oliver
  [solved] sunset rule doesn't work fleisch 4 441 10-26-2019, 07:05 AM
Last Post: fleisch
  Rule with&without device. One working not the other... Tamadite 9 1,388 07-24-2018, 08:55 AM
Last Post: curlymo
  rule executed once at start up segalion 3 748 07-12-2018, 05:28 PM
Last Post: curlymo
  Problem with executing bash script via rule/program dYna 1 1,037 02-15-2018, 09:06 PM
Last Post: dYna
  Rule Sunset works, Sunrise not apartmedia 1 1,189 12-05-2017, 07:09 PM
Last Post: apartmedia
  Problem with a Rule for a One Button Switch martin-dj 1 1,346 03-06-2017, 12:01 PM
Last Post: pilino1234
  Rule executed at wrong time philipp81 1 966 02-25-2017, 10:43 PM
Last Post: curlymo

Forum Jump:

Browsing: 1 Guest(s)