Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Changing RuleEngine thread pool size does not appear to have any affect (always 5) #6289

Closed
5iver opened this issue Sep 28, 2018 · 36 comments
Closed

Comments

@5iver
Copy link
Contributor

5iver commented Sep 28, 2018

Using OH snapshot 1372, after modifying runtime.cfg, the thread pools do not seem to change from 5. Discussed in the OH forum...

https://community.openhab.org/t/sporadic-delayed-rule-starting-thread-pool-too-small/52425/6?u=5iver

I didn't look into it much, but the other thread pool settings appear to take the settings properly from runtime.cfg. Related to #5040, and hopefully this will put some life back into #5081.

@htreu
Copy link
Contributor

htreu commented Sep 28, 2018

I can not reproduce the behaviour you describe. When configuring the RuleEngine thread pool like

org.eclipse.smarthome.threadpool:RuleEngine=10

in smarthome.cfg and restart my instance I get the following output for the example you posted in the forum:

10:21:05.689 DEBUG o.e.s.model.script.Rules[:39] - Test3: Start
10:21:05.690 DEBUG o.e.s.model.script.Rules[:39] - Test6: Start
10:21:05.690 DEBUG o.e.s.model.script.Rules[:39] - Test10: Start
10:21:05.690 DEBUG o.e.s.model.script.Rules[:39] - Test9: Start
10:21:05.689 DEBUG o.e.s.model.script.Rules[:39] - Test7: Start
10:21:05.689 DEBUG o.e.s.model.script.Rules[:39] - Test8: Start
10:21:05.689 DEBUG o.e.s.model.script.Rules[:39] - Test2: Start
10:21:05.690 DEBUG o.e.s.model.script.Rules[:39] - Test1: Start
10:21:05.691 DEBUG o.e.s.model.script.Rules[:39] - Test4: Start
10:21:05.691 DEBUG o.e.s.model.script.Rules[:39] - Test5: Start
10:21:15.701 DEBUG o.e.s.model.script.Rules[:39] - Test2: End
10:21:15.701 DEBUG o.e.s.model.script.Rules[:39] - Test1: End
10:21:15.703 DEBUG o.e.s.model.script.Rules[:39] - Test3: End
10:21:15.703 DEBUG o.e.s.model.script.Rules[:39] - Test9: End
10:21:15.701 DEBUG o.e.s.model.script.Rules[:39] - Test10: End
10:21:15.701 DEBUG o.e.s.model.script.Rules[:39] - Test5: End
10:21:15.705 DEBUG o.e.s.model.script.Rules[:39] - Test6: End
10:21:15.704 DEBUG o.e.s.model.script.Rules[:39] - Test8: End
10:21:15.702 DEBUG o.e.s.model.script.Rules[:39] - Test4: End
10:21:15.702 DEBUG o.e.s.model.script.Rules[:39] - Test7: End

Also, thread list looks like this:

Thread             ESH-RuleEngine-10     main              5 [daemon]
Thread             ESH-RuleEngine-11     main              5 [daemon]
Thread             ESH-RuleEngine-2      main              5 [daemon]
Thread             ESH-RuleEngine-3      main              5 [daemon]
Thread             ESH-RuleEngine-4      main              5 [daemon]
Thread             ESH-RuleEngine-5      main              5 [daemon]
Thread             ESH-RuleEngine-6      main              5 [daemon]
Thread             ESH-RuleEngine-7      main              5 [daemon]
Thread             ESH-RuleEngine-8      main              5 [daemon]
Thread             ESH-RuleEngine-9      main              5 [daemon]

I will close here, please reopen with more details when you think there is a bug.

@htreu htreu closed this as completed Sep 28, 2018
@5iver
Copy link
Contributor Author

5iver commented Sep 28, 2018

org.eclipse.smarthome.threadpool:RuleEngine=10

There's a capital R in RuleEngine but the others are camel case! Was hoping that would help, but after correcting the capitalization and a restart, the thread pool change is still not updating properly on my system (same results as posted in the forum). Currently on snapshot 1374. Hmmm...

Another oddity is that the case does not seem to matter... Karaf always shows the change but only 5 rules will run at a time.

@jboeddeker
Copy link

jboeddeker commented Sep 28, 2018

I am 2.3 stable and i also do not see an increased number of threads. Although the configured value now changes.

This is after a restart.

openhab> config:list "(service.pid=org.eclipse.smarthome.threadpool)"
----------------------------------------------------------------
Pid:            org.eclipse.smarthome.threadpool
BundleLocation: null
Properties:
   discovery = 50
   homematicGateway = 50
   homematicRpc = 50
   ruleEngine = 50
   safeCall = 50
   service.pid = org.eclipse.smarthome.threadpool
   thingHandler = 50
openhab> shell:threads --list |grep "RuleEngine"
1474 │ ESH-RuleEngine-20                                                                            │ TIMED_WAITING │ 205      │ 200
1605 │ ESH-RuleEngine-22                                                                            │ TIMED_WAITING │ 147      │ 140
1725 │ ESH-RuleEngine-24                                                                            │ TIMED_WAITING │ 47       │ 40
1726 │ ESH-RuleEngine-25                                                                            │ TIMED_WAITING │ 54       │ 50
1729 │ ESH-RuleEngine-26                                                                            │ TIMED_WAITING │ 65       │ 60
1792 │ pipe-grep "RuleEngine"                                                                       │ RUNNABLE      │ 5        │ 0

Here is a log:

2018-09-28 11:57:57.285 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created scheduled thread pool 'discovery' of size 5
2018-09-28 11:57:59.299 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created scheduled thread pool 'file-processing' of size 5
2018-09-28 11:58:00.551 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created thread pool 'ConfigStatusService' with size 5
2018-09-28 11:58:01.234 [DEBUG] [rthome.core.common.ThreadPoolManager] - Updated scheduled thread pool 'discovery' to size 50
2018-09-28 11:58:01.251 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created thread pool 'safeCall' with size 50
2018-09-28 12:00:17.873 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created scheduled thread pool 'RuleEngine' of size 5
2018-09-28 12:00:20.714 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created thread pool 'lsp' with size 5
2018-09-28 12:00:36.584 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created scheduled thread pool 'thingManager' of size 5
2018-09-28 12:00:36.642 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created scheduled thread pool 'thingHandler' of size 50
2018-09-28 12:00:37.107 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created thread pool 'items' with size 5
2018-09-28 12:00:40.190 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created scheduled thread pool 'thingLinkManager' of size 5
2018-09-28 12:00:48.694 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created scheduled thread pool 'upnp-io' of size 5
2018-09-28 12:00:51.221 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created scheduled thread pool 'homematicGateway' of size 50
2018-09-28 12:00:51.772 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created thread pool 'homematicRpc' with size 50

I am restarting again with a 'RuleEngine' property

@jboeddeker
Copy link

Here is now the result with an uppercase 'R'.

runtime.cfg

org.eclipse.smarthome.threadpool:thingHandler=50
org.eclipse.smarthome.threadpool:discovery=50
org.eclipse.smarthome.threadpool:safeCall=50

org.eclipse.smarthome.threadpool:homematicGateway=50
org.eclipse.smarthome.threadpool:homematicRpc=50
org.eclipse.smarthome.threadpool:RuleEngine=50
#org.eclipse.smarthome.threadpool:ruleEngine=50

config: the uppercase 'R' property is missing!

openhab> config:list "(service.pid=org.eclipse.smarthome.threadpool)"
----------------------------------------------------------------
Pid:            org.eclipse.smarthome.threadpool
BundleLocation: null
Properties:
   discovery = 50
   homematicGateway = 50
   homematicRpc = 50
   ruleEngine = 50
   safeCall = 50
   service.pid = org.eclipse.smarthome.threadpool
   thingHandler = 50

the threads

openhab> shell:threads --list |grep "RuleEngine"
570 │ ESH-RuleEngine-4                                                                             │ TIMED_WAITING │ 103      │ 100
584 │ ESH-RuleEngine-5                                                                             │ TIMED_WAITING │ 915      │ 910
594 │ ESH-RuleEngine-6                                                                             │ TIMED_WAITING │ 1296     │ 1290
663 │ ESH-RuleEngine-7                                                                             │ TIMED_WAITING │ 2969     │ 2960
858 │ ESH-RuleEngine-8                                                                             │ TIMED_WAITING │ 24       │ 20
933 │ pipe-grep "RuleEngine"                                                                       │ TIMED_WAITING │ 18       │ 10

the log:

2018-09-28 12:42:33.982 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created scheduled thread pool 'discovery' of size 5
2018-09-28 12:42:36.011 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created scheduled thread pool 'file-processing' of size 5
2018-09-28 12:42:37.206 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created thread pool 'ConfigStatusService' with size 5
2018-09-28 12:42:37.701 [DEBUG] [rthome.core.common.ThreadPoolManager] - Updated scheduled thread pool 'discovery' to size 50
2018-09-28 12:42:37.744 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created thread pool 'safeCall' with size 50
2018-09-28 12:44:53.369 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created thread pool 'lsp' with size 5
2018-09-28 12:44:53.953 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created scheduled thread pool 'RuleEngine' of size 5
2018-09-28 12:45:12.305 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created scheduled thread pool 'thingManager' of size 5
2018-09-28 12:45:12.357 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created scheduled thread pool 'thingHandler' of size 50
2018-09-28 12:45:12.859 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created thread pool 'items' with size 5
2018-09-28 12:45:16.434 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created scheduled thread pool 'thingLinkManager' of size 5
2018-09-28 12:45:23.557 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created scheduled thread pool 'upnp-io' of size 5
2018-09-28 12:45:25.944 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created scheduled thread pool 'homematicGateway' of size 50
2018-09-28 12:45:26.494 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created thread pool 'homematicRpc' with size 50

So, some part of openHAB does not like the uppercase 'R' in RuleEngine.

@jboeddeker
Copy link

jboeddeker commented Sep 28, 2018

@htreu, on what kind of system did you find your results? And how can i reopen this issue?

I am running on openHABian with Oracle Java on a Raspberry Pi 3+. Using openHAB 2.3.

@jboeddeker
Copy link

I found a difference, retesting. I was using 'runtime.cfg', @htreu, you are using 'smarthome.cfg'.

@kaikreuzer
Copy link
Contributor

It is smarthome.cfg in the ESH IDE, but runtime.cfg in the openHAB distro.

@kaikreuzer kaikreuzer reopened this Sep 28, 2018
@kaikreuzer
Copy link
Contributor

@htreu I actually would expect the parameter to be lower case, too.

@jboeddeker
Copy link

jboeddeker commented Sep 28, 2018

Thanks.

I also received the same results with smarthome.cfg in my latest test. Threadpool size for RuleEngine is still at 5, property for threadpool size is at 50. (I removed the property from runtime.cfg and added a smarthome.cfg with just that one property.)

@htreu
Copy link
Contributor

htreu commented Sep 28, 2018

The thread pool in RuleEngineImpl is created like this: ThreadPoolManager.getScheduledPool(RuleEngine.class.getSimpleName()) so even if its not case sensitive for the config admin service, the capital R is as close to the source as it gets.

Wrt Karaf: Is there a config cache which config admin uses?

I will retry with the latest openHAB runtime and see whats happening.

@kaikreuzer
Copy link
Contributor

The thread pool in RuleEngineImpl is created like this:

We should use the chance that it is anyhow not really working and change this to be following the same naming scheme as the other thread pools.

@htreu
Copy link
Contributor

htreu commented Sep 28, 2018

not really working

working for ESH only!

But I agree, the pool name feels very wrong. I will see what openHAB runtime says.

@htreu
Copy link
Contributor

htreu commented Sep 28, 2018

for openHAB (Karaf) there is the dedicated userdata/config/org/eclipse/smarthome/threadpool.config file which controls pool sizes. Entering RuleEngine="10" has the desired effect.

@kaikreuzer
Copy link
Contributor

This is just the internal data structure of the CM implementation - DO NOT TOUCH IT!

@htreu
Copy link
Contributor

htreu commented Sep 28, 2018

At least a hint, thanks. I will investigate again.

@htreu
Copy link
Contributor

htreu commented Oct 1, 2018

Here are my observations with a freshly installed openHAB, build 1378:

Without any modifications and the simple script I get the following output:

14:56:00.627 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test5: Start
14:56:00.627 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test9: Start
14:56:00.629 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test4: Start
14:56:00.630 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test3: Start
14:56:00.630 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test8: Start
14:56:10.636 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test9: End
14:56:10.636 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test4: End
14:56:10.636 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test8: End
14:56:10.636 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test5: End
14:56:10.639 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test6: Start
14:56:10.639 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test2: Start
14:56:10.636 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test3: End
14:56:10.639 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test1: Start
14:56:10.641 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test10: Start
14:56:10.642 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test7: Start
14:56:20.645 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test6: End
14:56:20.645 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test100: End
14:56:20.646 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test2: End
14:56:20.646 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test7: End
14:56:20.645 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test1: End

and content of userdata/config/org/eclipse/smarthome/threadpool.config:

discovery="5"
safeCall="10"
service.pid="org.eclipse.smarthome.threadpool"
thingHandler="5"

With conf/services/runtime.cfg to include the line

org.eclipse.smarthome.threadpool:RuleEngine=10

I get the following log output:

15:00:45.780 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Virtual_Switch_1' received command OFF
15:00:45.785 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test8: Start
15:00:45.785 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test3: Start
15:00:45.786 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test9: Start
15:00:45.786 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test5: Start
15:00:45.787 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test4: Start
15:00:45.791 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test7: Start
15:00:45.791 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test6: Start
15:00:45.792 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test10: Start
15:00:45.793 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test2: Start
15:00:45.793 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test1: Start
15:00:45.794 [INFO ] [smarthome.event.ItemStateChangedEvent] - Virtual_Switch_1 changed from ON to OFF
15:00:55.788 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test8: End
15:00:55.788 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test5: End
15:00:55.788 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test9: End
15:00:55.789 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test4: End
15:00:55.790 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test3: End
15:00:55.796 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test2: End
15:00:55.796 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test7: End
15:00:55.796 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test6: End
15:00:55.796 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test100: End
15:00:55.796 [DEBUG] [.eclipse.smarthome.model.script.Rules] - Test1: End

and content in the config file:

RuleEngine="10"
discovery="5"
safeCall="10"
service.pid="org.eclipse.smarthome.threadpool"
thingHandler="5"

All this w/o a restart. The runtime.cfg is re-read and the thread pool size updated automatically.

@kaikreuzer
Copy link
Contributor

Are you going to change RuleEngine to ruleEngine?

@5iver
Copy link
Contributor Author

5iver commented Oct 1, 2018

My /conf/services/runtime.cfg currently has this...

org.eclipse.smarthome.threadpool:RuleEngine=10
org.eclipse.smarthome.threadpool:thingHandler=5
org.eclipse.smarthome.threadpool:discovery=5
org.eclipse.smarthome.threadpool:safeCall=10

But my /userdata/config/org/eclipse/smarthome/threadpool.config shows this (note the different case in ruleEngine from yours)...

discovery="5"
ruleEngine="10"
safeCall="10"
service.pid="org.eclipse.smarthome.threadpool"
thingHandler="5"

Restarts and modifying runtime.cfg did not change this. But by manually changing /userdata/config/org/eclipse/smarthome/threadpool.config (replacing ruleEngine with RuleEngine) and restarting, I now have more than 5 threads and changes to runtime.cfg are reflected in threadpool.cfg!

@kaikreuzer
Copy link
Contributor

It might be that Felix ConfigAdmin has issues with cases and fails to update "RuleEngine", if there is already an entry "ruleEngine" - who knows...

@htreu
Copy link
Contributor

htreu commented Oct 1, 2018

Are you going to change RuleEngine to ruleEngine?

I will create a PR where discussion about backwards compatibility can take place.

htreu pushed a commit to htreu/smarthome that referenced this issue Oct 4, 2018
To conform to all other thread pool names change the rule engine thread pool name from `RuleEngine` to `ruleEngine`.

Relates to eclipse-archived#6289.

Signed-off-by: Henning Treu <henning.treu@telekom.de>
maggu2810 pushed a commit that referenced this issue Oct 5, 2018
To conform to all other thread pool names change the rule engine thread pool name from `RuleEngine` to `ruleEngine`.

Relates to #6289.

Signed-off-by: Henning Treu <henning.treu@telekom.de>
@5iver
Copy link
Contributor Author

5iver commented Oct 11, 2018

Resolved by #6310

@Jagohu
Copy link

Jagohu commented May 2, 2020

I have this issue right now on 2.5.
I have changed the runtime.cfg, but I never see more than 5 threads.

org.eclipse.smarthome.threadpool:RuleEngine=50
org.eclipse.smarthome.threadpool:thingHandler=30
org.eclipse.smarthome.threadpool:discovery=15
org.eclipse.smarthome.threadpool:safeCall=15

threadpool.config shows the same values, as it does in karaf, but still it's up to 5 threads only.
When I change any of the values in runtime.cfg, there are log entries saying I did so for 3 items, but not for the RuleEngine.
Can anyone help what am I doing wrong?
Cheers

@mhilbush
Copy link
Contributor

mhilbush commented May 2, 2020

RuleEngine=50

Did you try ruleEngine=50? It was changed to this from RuleEngine some time ago.

@Jagohu
Copy link

Jagohu commented May 2, 2020

I did and just did it again on a fresh install of OH - no change whatsoever...

@mhilbush
Copy link
Contributor

mhilbush commented May 2, 2020

I dunno. It works for me.

With this setting in runtime.cfg

org.eclipse.smarthome.threadpool:ruleEngine=8

And with this rule...

rule "Test Thread Pool"
when
	Item Test_Switch received command ON
then
	logInfo("test-thread-pool", "Rule running")
	Thread::sleep(20000)
	logInfo("test-thread-pool", "Done")
end

Using the console to send commands to the item, the executions queue up after 8 rules are executing.

2020-05-02 16:09:22.371 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-02 16:09:23.816 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-02 16:09:24.341 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-02 16:09:24.729 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-02 16:09:25.174 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-02 16:09:25.608 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-02 16:09:26.051 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-02 16:09:26.478 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-02 16:09:42.376 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-02 16:09:42.382 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-02 16:09:43.821 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-02 16:09:43.828 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-02 16:09:44.346 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-02 16:09:44.354 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-02 16:09:44.735 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-02 16:09:44.742 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-02 16:09:45.179 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-02 16:09:45.184 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-02 16:09:45.613 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-02 16:09:45.618 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-02 16:09:46.055 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-02 16:09:46.062 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-02 16:09:46.483 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-02 16:09:46.490 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-02 16:10:02.387 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-02 16:10:02.394 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-02 16:10:03.834 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-02 16:10:03.841 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-02 16:10:04.359 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-02 16:10:04.367 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-02 16:10:04.747 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-02 16:10:05.189 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-02 16:10:05.623 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-02 16:10:06.067 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-02 16:10:06.495 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-02 16:10:22.399 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-02 16:10:23.847 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-02 16:10:24.374 [INFO ] [rthome.model.script.test-thread-pool] - Done

@Jagohu
Copy link

Jagohu commented May 3, 2020

Tried it, doesn't work unfortunately. :(
It goes up to 5 "Rule running", then until the first rule times out nothing happens and then the next rule starts.

2020-05-03 11:11:49.617 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-03 11:11:50.270 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-03 11:11:50.913 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-03 11:11:51.519 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-03 11:11:52.060 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-03 11:12:09.627 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-03 11:12:09.634 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-03 11:12:10.273 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-03 11:12:10.306 [INFO ] [rthome.model.script.test-thread-pool] - Rule running
2020-05-03 11:12:10.918 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-03 11:12:12.543 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-03 11:12:12.544 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-03 11:12:29.640 [INFO ] [rthome.model.script.test-thread-pool] - Done
2020-05-03 11:12:30.310 [INFO ] [rthome.model.script.test-thread-pool] - Done

I have changed the /etc/openhab2/services/runtime.cfg to
org.eclipse.smarthome.threadpool:thingHandler=50
org.eclipse.smarthome.threadpool:discovery=20
org.eclipse.smarthome.threadpool:safeCall=50
org.eclipse.smarthome.threadpool:ruleEngine=8

But I can't see any change either changing from ruleEngine=50 to ruleEngine=8. I'm not sure if there's a maximum value at all.

@5iver
Copy link
Contributor Author

5iver commented May 3, 2020

Since 2.5M2, OH has not used ESH and many of the package names changed. Try org.openhab.threadpool:ruleEngine.

https://github.com/openhab/openhab-core/blob/master/bundles/org.openhab.core.model.rule.runtime/src/org/openhab/core/model/rule/runtime/internal/engine/RuleEngineImpl.java#L81

https://github.com/openhab/openhab-core/blob/master/bundles/org.openhab.core/src/main/java/org/openhab/core/common/ThreadPoolManager.java#L52

BTW, this will not be needed in OH 3.0, since the old rule engine will be removed.

@mhilbush
Copy link
Contributor

mhilbush commented May 3, 2020

I'm not sure if there's a maximum value at all.

openHAB doesn't impose a limit, so you're only limited by the config of the host on which you're running.

Maybe the original value is cached somewhere. What do you see in this file?

userdata/config/org/eclipse/smarthome/threadpool.config

@mhilbush
Copy link
Contributor

mhilbush commented May 3, 2020

Since 2.5M2, OH has not used ESH and many of the package names changed. Try org.openhab.threadpool:ruleEngine.

I think these were changed in 3.0. I seem to recall a PR that changed a bunch of them. For 2.5.x, I believe they are still org.eclipse.smarthome.threadpool. At least that's what's working for me. 😉

@5iver
Copy link
Contributor Author

5iver commented May 3, 2020

Of course! This wasn't renamed until late December. I should have looked into the history before replying...

@Jagohu
Copy link

Jagohu commented May 3, 2020

I'm not sure if there's a maximum value at all.

openHAB doesn't impose a limit, so you're only limited by the config of the host on which you're running.

Maybe the original value is cached somewhere. What do you see in this file?

userdata/config/org/eclipse/smarthome/threadpool.config

:org.apache.felix.configadmin.revision:=L"13"
RuleEngine="10"
discovery="20"
safeCall="50"
service.pid="org.eclipse.smarthome.threadpool"
thingHandler="50"
This looks OK to me, according to the last update of runtime.cfg

Of course! This wasn't renamed until late December. I should have looked into the history before

replying...

Um, sorry I'm not quite sure I'm getting your point :) Could you elaborate please?

@mhilbush
Copy link
Contributor

mhilbush commented May 3, 2020

This looks OK to me, according to the last update of runtime.cfg

No it's not ok. It contains RuleEngine, but not ruleEngine. Here's what mine looks like.

:org.apache.felix.configadmin.revision:=L"42"
discovery="30"
org.quartz.threadPool.threadCount="20"
ruleEngine="30"
safeCall="40"
service.pid="org.eclipse.smarthome.threadpool"
thingHandler="50"

@Jagohu
Copy link

Jagohu commented May 3, 2020

Hah, ok... I should maybe change it there directly... Does the first line have any importance or should I just omit that from yours and keep what I have?

It's interesting because at the same time in my runtime.cfg it's with small letters:

org.eclipse.smarthome.threadpool:thingHandler=50
org.eclipse.smarthome.threadpool:discovery=20
org.eclipse.smarthome.threadpool:safeCall=50
org.eclipse.smarthome.threadpool:ruleEngine=10

@mhilbush
Copy link
Contributor

mhilbush commented May 3, 2020

I seem to recall that it's advisable to shutdown openHAB before you edit that file.

Does the first line have any importance

Sorry, I have no idea. If it were me, I'd only edit what was absolutely necessary.

@Jagohu
Copy link

Jagohu commented May 3, 2020

Will do, but I'll only have time for it tomorrow. Thank you for your help, I'll post my results!

@Jagohu
Copy link

Jagohu commented May 4, 2020

It works. :) Thank you very much for the help and thank you for sharing your config file!
I have kept the first line of my config file, replaced the rest with yours. Nevertheless it was overwritten by the runtime.cfg values upon startup.
So the issue seems to me that in the original threadpool.config the value was with a capital R and only the numeric value got replaced.
I have changed it manually to your ruleEngine="30", and the system updated it to 50 as it was defined in the runtime.cfg, but without renaming it to RuleEngine as it was before. This way it does work.
Thanks again!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants