[SOLVED] Strange rules behavior (including timers)

mytimer.cancel just removes any future execution trigger. That’s all it does.

That’s right - see above

Yes. It’s obviously up to you how manage aborting one of your long sequences part way through, whatever tidying up may need to happen.

In the background is still consuming a thread. You can either use a Rules thread, of which by default there is 5, it a timer thread which by default there are two.

Many small fast running rules as far far better than fewer long running rules.

I completely agree with rossko57. It would be far better for you to break this huge complicated rule into several smaller rules. These will be easier to understand, take less time to run (which is the key factor for avoiding running it if threads) and be easier to find errors.

I’ll also recommend again that switching to Expire binding fort Timers may help make the rules simpler and less error prone as well.

Ultimately, if you can convert this long and complicated set of rules into a series of simpler and faster running rules you will be far better off.

I’ll consider rewriting all to smaller Rules, but I have limited options, that all task included should run i propper sequence.

Afterr that I added aditional check that handle is not null just before each reschedule, problem dissapeared. :wink:

Once again… Thanks guys. It’s good to have such great support.

PS Enybody have knowledge how and where to trim threads setting? I mainly mean: org.eclipse.smarthome.threadpool:safeCall and org.eclipse.smarthome.threadpool:ruleEngine. Is it even possible in OH 2.4 (i read somewhere that there is some problem with lower uppercase variable name of Rules Threads, it looks like settings doesn’t take affect os system (changing rules threads = still max 5 threads running))?

Yes, of course.
But there is more than one way to do most tasks.

openHAB is event driven, the most “natural” way to do sequences is to kick off task A. When something responds “task A complete”, then you can trigger task B from that.
That’s not always possible, and you can turn to timers and delays as second-choice methods.

Enybody have knowledge how and where to trim threads setting? I mainly mean: org.eclipse.smarthome.threadpool:safeCall and org.eclipse.smarthome.threadpool:ruleEngine. Is it even possible in OH 2.4 (i read somewhere that there is some problem with lower uppercase variable name of Rules Threads, it looks like settings doesn’t take affect os system (changing rules threads = still max 5 threads running))?

This thread discusses all of this. Why have my Rules stopped running? Why Thread::sleep is a bad idea

The file is at the bottom of the first post but the rest of the thread has useful information as well.