KNX sometimes does not start up, reload helps

I’ve sometimes the problem that when openhab starts, the knx2 binding does not work. Sometimes it displays error messages like this in the log (which just happened to me right now while restarting openhab):

2019-04-07 00:08:01.376 [ERROR] [.thing.internal.GenericThingProvider] - Channel type knx:number could not be resolved.
2019-04-07 00:08:01.376 [ERROR] [.thing.internal.GenericThingProvider] - Channel type knx:number could not be resolved.
2019-04-07 00:08:01.377 [ERROR] [.thing.internal.GenericThingProvider] - Channel type knx:contact could not be resolved.
2019-04-07 00:08:01.377 [ERROR] [.thing.internal.GenericThingProvider] - Channel type knx:number could not be resolved.

… and …

2019-04-07 00:08:01.472 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.knx.internal.handler.DeviceThingHandler@54a$
aa0b': null
java.lang.NullPointerException: null
        at org.openhab.binding.knx.internal.handler.DeviceThingHandler.initialize(DeviceThingHandler.java:85) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [102:org.eclipse.smarthome.core:0.10.0.oh240]
        at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [102:org.eclipse.smarthome.core:0.10.0.oh240]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]

The fix is always simple: Just touch my things/knx.things (where the bridge and things are configured). It then writes to the log:

2019-04-07 00:18:01.120 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'knx.things'
2019-04-07 00:18:02.235 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'knx.things'

… and everything works!

It looks like knx things/items are loaded too early, maybe before knx2 binding is initialized on startup? Sometimes it works directly after startup, sometimes not (I have the feeling not more often than it works). Is there a race condition maybe?

Does anybody else have the same problem?

This happens to me on openhab 2.4 on arch linux.

Hi,

same for me. Any news to this topic?

See https://github.com/openhab/openhab2-addons/issues/3414 for the issue and a possible workaround. Though it does not help 100 % for me it seems to make it occur less often.