Invalid load order of configuration file - not calling channelLinked

Hello,

I’m using stable 2.3.0.1 version on RPI.
From some time I have problem with proper working of my binding MCP23017.
Output pins works fine, bud INPUT does not.
I’ve been investigating problem and discovered that my contact.items file (which contains definition of my input Items and referes to specified thing) is loaded before my mcp.things file - which contains definition of thing.
So - “channelLinked” method of thingHander is not called because thing is not yet initialized, and MCP2307 pins are not initialised.

Is there any method to change loading order? To force loading *.things file before *.items?
Or any other method to call "channelLinked for all channels in thing after initialization?

Something broke in current version. It worked fine in 2.2.0.

A workaround is to move contact.items to another folder, restart openhab, and manually copy it again to /etc/openhab2/items after full boot of openhab, but it is manual work… It breaks after every reboot…

Loading order of *items and *.things files should not have any effect on whether channelLinked gets called or not. When a thing handler initializes (change status from INITIALIZING to either UNKNOWN, ONLINE or OFFLINE) the framework will call channelLinked for every active channel-item-link available. See https://github.com/eclipse/smarthome/blob/ref-0.10.0.b1/bundles/core/org.eclipse.smarthome.core.thing/src/main/java/org/eclipse/smarthome/core/thing/link/ThingLinkManager.java#L283 for reference.
If you nonetheless have trouble please create an issue at the Eclipse SmartHome issue tracker here: https://github.com/eclipse/smarthome/issues

Thanks & Cheers
Henning

Yes, I saw that piece of code. The problem is that it is not called, or “if” conditions are not letting to call “channelLinked”.
Unfortunatelly there are no debug’s to check where is the problem.
I’ll check it one more time and if I will not find anything I’ll create an issue in Eclipse SmartHome.

Thanks
Tolek

Ok, i dug a little more, and I discovered that this piece of code isn’t called at all for this thing.
It is called for things from other bindings, but not for these from mcp23017.
Do You have any clues what might be a reason?

Log for other binding looks like this:

2018-08-13 18:20:43.083 [TRACE] [me.core.internal.events.EventHandler] - Handle OSGi event (event: org.osgi.service.event.Event [topic=smarthome] {topic=smarthome/things/onewiregpio:sensor:kotlownia/statuschanged, type=ThingStatusInfoChan
gedEvent, payload=[{"status":"ONLINE","statusDetail":"NONE"},{"status":"INITIALIZING","statusDetail":"NONE"}], timestamp=1534177242820})
2018-08-13 18:20:43.084 [TRACE] [.internal.common.SafeCallManagerImpl] - Triggering submissions for 'org.eclipse.smarthome.io.rest.sse.internal.listeners.SseEventSubscriber@10c7e43'
2018-08-13 18:20:43.086 [TRACE] [.internal.common.SafeCallManagerImpl] - Triggering submissions for 'org.eclipse.smarthome.core.thing.internal.firmware.FirmwareUpdateServiceImpl@f6c566'
2018-08-13 18:20:43.087 [TRACE] [.internal.common.SafeCallManagerImpl] - Scheduling invocation of 'receive()' on 'org.eclipse.smarthome.core.thing.internal.firmware.FirmwareUpdateServiceImpl@f6c566' for asynchronous execution
2018-08-13 18:20:43.089 [TRACE] [.internal.common.SafeCallManagerImpl] - Scheduling timeout watcher in 5000ms
2018-08-13 18:20:43.090 [TRACE] [.internal.common.SafeCallManagerImpl] - Submitted invocation of 'receive()' on 'org.eclipse.smarthome.core.thing.internal.firmware.FirmwareUpdateServiceImpl@f6c566' for asynchronous execution
2018-08-13 18:20:43.091 [TRACE] [.internal.common.SafeCallManagerImpl] - Finished invocation of 'receive()' on 'org.eclipse.smarthome.core.thing.internal.firmware.FirmwareUpdateServiceImpl@f6c566'
2018-08-13 18:20:43.092 [TRACE] [.internal.common.SafeCallManagerImpl] - Triggering submissions for 'org.eclipse.smarthome.config.discovery.internal.AutomaticInboxProcessor@2eb35f'
2018-08-13 18:20:43.092 [TRACE] [.internal.common.SafeCallManagerImpl] - Triggering submissions for 'org.eclipse.smarthome.core.thing.internal.firmware.FirmwareUpdateServiceImpl@f6c566'
2018-08-13 18:20:43.094 [TRACE] [.internal.common.SafeCallManagerImpl] - Scheduling invocation of 'receive()' on 'org.eclipse.smarthome.config.discovery.internal.AutomaticInboxProcessor@2eb35f' for asynchronous execution
2018-08-13 18:20:43.095 [TRACE] [.internal.common.SafeCallManagerImpl] - Submitted invocation of 'receive()' on 'org.eclipse.smarthome.config.discovery.internal.AutomaticInboxProcessor@2eb35f' for asynchronous execution
2018-08-13 18:20:43.095 [TRACE] [.internal.common.SafeCallManagerImpl] - Scheduling timeout watcher in 5000ms
2018-08-13 18:20:43.096 [TRACE] [.internal.common.SafeCallManagerImpl] - Triggering submissions for 'org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl@111e1d2'
2018-08-13 18:20:43.096 [TRACE] [.internal.common.SafeCallManagerImpl] - Finished invocation of 'receive()' on 'org.eclipse.smarthome.config.discovery.internal.AutomaticInboxProcessor@2eb35f'
2018-08-13 18:20:43.097 [TRACE] [.internal.common.SafeCallManagerImpl] - Triggering submissions for 'org.eclipse.smarthome.config.discovery.internal.AutomaticInboxProcessor@2eb35f'
2018-08-13 18:20:43.097 [TRACE] [.internal.common.SafeCallManagerImpl] - Scheduling invocation of 'receive()' on 'org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl@111e1d2' for asynchronous execution
2018-08-13 18:20:43.106 [TRACE] [.internal.common.SafeCallManagerImpl] - Submitted invocation of 'receive()' on 'org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl@111e1d2' for asynchronous execution
2018-08-13 18:20:43.106 [TRACE] [.internal.common.SafeCallManagerImpl] - Scheduling timeout watcher in 5000ms
2018-08-13 18:20:43.107 [TRACE] [.internal.common.SafeCallManagerImpl] - Finished invocation of 'receive()' on 'org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl@111e1d2'
2018-08-13 18:20:43.107 [TRACE] [.internal.common.SafeCallManagerImpl] - Triggering submissions for 'org.eclipse.smarthome.core.thing.link.ThingLinkManager@700835'
2018-08-13 18:20:43.108 [TRACE] [.internal.common.SafeCallManagerImpl] - Triggering submissions for 'org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl@111e1d2'
2018-08-13 18:20:43.147 [TRACE] [.internal.common.SafeCallManagerImpl] - Scheduling invocation of 'receive()' on 'org.eclipse.smarthome.core.thing.link.ThingLinkManager@700835' for asynchronous execution

There is call to ThinkLinkManager

and for mcp23017 there is:

2018-08-13 18:25:16.335 [TRACE] [me.core.internal.events.EventHandler] - Handle OSGi event (event: org.osgi.service.event.Event [topic=smarthome] {topic=smarthome/things/mcp23017:mcp23017:chipA/statuschanged, type=ThingStatusInfoChangedEv
ent, payload=[{"status":"ONLINE","statusDetail":"NONE"},{"status":"INITIALIZING","statusDetail":"NONE"}], timestamp=1534177516321})
2018-08-13 18:25:16.336 [TRACE] [.internal.common.SafeCallManagerImpl] - Finished invocation of 'receive()' on 'org.eclipse.smarthome.io.monitor.internal.EventLogger@1b51f6'
2018-08-13 18:25:16.336 [TRACE] [.internal.common.SafeCallManagerImpl] - Triggering submissions for 'org.eclipse.smarthome.core.thing.internal.firmware.FirmwareUpdateServiceImpl@4bb6c'
2018-08-13 18:25:16.336 [TRACE] [.internal.common.SafeCallManagerImpl] - Triggering submissions for 'org.eclipse.smarthome.io.monitor.internal.EventLogger@1b51f6'
2018-08-13 18:25:16.337 [TRACE] [.internal.common.SafeCallManagerImpl] - Scheduling invocation of 'receive()' on 'org.eclipse.smarthome.core.thing.internal.firmware.FirmwareUpdateServiceImpl@4bb6c' for asynchronous execution
2018-08-13 18:25:16.338 [TRACE] [.internal.common.SafeCallManagerImpl] - Submitted invocation of 'receive()' on 'org.eclipse.smarthome.core.thing.internal.firmware.FirmwareUpdateServiceImpl@4bb6c' for asynchronous execution
2018-08-13 18:25:16.338 [TRACE] [.internal.common.SafeCallManagerImpl] - Scheduling timeout watcher in 5000ms
2018-08-13 18:25:16.339 [TRACE] [.internal.common.SafeCallManagerImpl] - Triggering submissions for 'org.eclipse.smarthome.io.rest.sse.internal.listeners.SseEventSubscriber@119d651'
2018-08-13 18:25:16.340 [TRACE] [.internal.common.SafeCallManagerImpl] - Finished invocation of 'receive()' on 'org.eclipse.smarthome.core.thing.internal.firmware.FirmwareUpdateServiceImpl@4bb6c'
2018-08-13 18:25:16.340 [TRACE] [.internal.common.SafeCallManagerImpl] - Scheduling invocation of 'receive()' on 'org.eclipse.smarthome.io.rest.sse.internal.listeners.SseEventSubscriber@119d651' for asynchronous execution
2018-08-13 18:25:16.341 [TRACE] [.internal.common.SafeCallManagerImpl] - Scheduling timeout watcher in 5000ms
2018-08-13 18:25:16.341 [TRACE] [.internal.common.SafeCallManagerImpl] - Triggering submissions for 'org.eclipse.smarthome.core.thing.internal.firmware.FirmwareUpdateServiceImpl@4bb6c'
2018-08-13 18:25:16.341 [TRACE] [.internal.common.SafeCallManagerImpl] - Submitted invocation of 'receive()' on 'org.eclipse.smarthome.io.rest.sse.internal.listeners.SseEventSubscriber@119d651' for asynchronous execution
2018-08-13 18:25:16.342 [TRACE] [.internal.common.SafeCallManagerImpl] - Triggering submissions for 'org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl@a5d9b9'
2018-08-13 18:25:16.342 [TRACE] [.internal.common.SafeCallManagerImpl] - Finished invocation of 'receive()' on 'org.eclipse.smarthome.io.rest.sse.internal.listeners.SseEventSubscriber@119d651'
2018-08-13 18:25:16.343 [TRACE] [.internal.common.SafeCallManagerImpl] - Scheduling invocation of 'receive()' on 'org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl@a5d9b9' for asynchronous execution
2018-08-13 18:25:16.344 [TRACE] [.internal.common.SafeCallManagerImpl] - Triggering submissions for 'org.eclipse.smarthome.io.rest.sse.internal.listeners.SseEventSubscriber@119d651'
2018-08-13 18:25:16.344 [TRACE] [.internal.common.SafeCallManagerImpl] - Scheduling timeout watcher in 5000ms
2018-08-13 18:25:16.345 [TRACE] [.internal.common.SafeCallManagerImpl] - Submitted invocation of 'receive()' on 'org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl@a5d9b9' for asynchronous execution
2018-08-13 18:25:16.346 [TRACE] [.internal.common.SafeCallManagerImpl] - Finished invocation of 'receive()' on 'org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl@a5d9b9'
2018-08-13 18:25:16.347 [TRACE] [.internal.common.SafeCallManagerImpl] - Triggering submissions for 'org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl@a5d9b9'
2018-08-13 18:25:16.348 [TRACE] [.internal.common.SafeCallManagerImpl] - Triggering submissions for 'org.eclipse.smarthome.io.monitor.internal.EventLogger@1b51f6'
2018-08-13 18:25:16.349 [TRACE] [.internal.common.SafeCallManagerImpl] - Scheduling invocation of 'receive()' on 'org.eclipse.smarthome.io.monitor.internal.EventLogger@1b51f6' for asynchronous execution
2018-08-13 18:25:16.353 [TRACE] [.internal.common.SafeCallManagerImpl] - Scheduling timeout watcher in 5000ms
2018-08-13 18:25:16.353 [TRACE] [.internal.common.SafeCallManagerImpl] - Submitted invocation of 'receive()' on 'org.eclipse.smarthome.io.monitor.internal.EventLogger@1b51f6' for asynchronous execution
2018-08-13 18:25:16.355 [TRACE] [.internal.common.SafeCallManagerImpl] - Finished invocation of 'receive()' on 'org.eclipse.smarthome.io.monitor.internal.EventLogger@1b51f6'
2018-08-13 18:25:16.355 [TRACE] [.internal.common.SafeCallManagerImpl] - Triggering submissions for 'org.eclipse.smarthome.io.monitor.internal.EventLogger@1b51f6'
2018-08-13 18:25:16.394 [DEBUG] [ing.mcp23017.handler.Mcp23017Handler] - got mcpProvider com.pi4j.gpio.extension.mcp.MCP23017GpioProvider@1e78780
2018-08-

No sign of ThingLinkManager…

Do You have any idea why this eventHandler isn’t bound to that event?
Why isn’t it called?

Please create an issue at the Eclipse SmartHome tracker https://github.com/eclipse/smarthome/issues. This way all community members are able to help. Add all your logs and even an excerpt from this conversation with our first diagnosis. Thanks.

I thing, that the problem is solved.
It turned out, that in initialize() method of my binding I called super.initialize(). It caused all trouble.
In previous version of OH it worked, but it stopped in 2.3

I made a fix and pull request here:

Thanx for help