openbase / bco.dal

Domotic Abstraction Layer
Other
1 stars 2 forks source link

Label change can cause duplicated RPC registration #115

Closed pLeminoq closed 6 years ago

pLeminoq commented 6 years ago

Changing the label of a unit during runtime caused an error where the same RPC is registered twice.

09:35:40.583 [Thread-8] ERROR o.o.b.d.l.l.u.TemperatureControllerController ═╦═⚀ Could not update unit config of org.openbase.bco.dal.lib.layer.unit.AbstractUnitController$1@11d7855
09:35:40.584 [Thread-8] ERROR o.o.b.d.l.l.u.TemperatureControllerController  ╚══╦═⚀ Could not apply config update!
09:35:40.584 [Thread-8] ERROR o.o.b.d.l.l.u.TemperatureControllerController     ╚══╦═⚀ Could not verify scope changes!
09:35:40.584 [Thread-8] ERROR o.o.b.d.l.l.u.TemperatureControllerController        ╚══╦═⚀ Could not initialize class org.openbase.bco.dal.lib.layer.unit.TemperatureControllerController!
09:35:40.584 [Thread-8] ERROR o.o.b.d.l.l.u.TemperatureControllerController           ╚══╦═⚀ Could not register Method[requestDataAuthenticated] on Scope[/home/temperaturecontroller/temperaturregler/ctrl/] of TemperatureControllerController[TEMPERATURE_CONTROLLER[Temperaturregler]]!
09:35:40.585 [Thread-8] ERROR o.o.b.d.l.l.u.TemperatureControllerController              ╚══╦═⚀ Could not add Method[requestDataAuthenticated]!
09:35:40.585 [Thread-8] ERROR o.o.b.d.l.l.u.TemperatureControllerController                 ╚════⚀ A method with name requestDataAuthenticated already exists.
09:35:40.585 [Thread-8] ERROR o.o.b.d.l.l.u.TemperatureControllerController =====================================
09:35:40.631 [Thread-8] ERROR o.o.b.d.l.l.u.TemperatureControllerController Could not update unit config of org.openbase.bco.dal.lib.layer.unit.AbstractUnitController$1@11d7855
org.openbase.jul.exception.CouldNotPerformException: Could not update unit config of org.openbase.bco.dal.lib.layer.unit.AbstractUnitController$1@11d7855
    at org.openbase.jul.exception.printer.ExceptionPrinter.printHistory(ExceptionPrinter.java:174)
    at org.openbase.bco.dal.lib.layer.unit.AbstractUnitController$1.update(AbstractUnitController.java:142)
    at org.openbase.bco.dal.lib.layer.unit.AbstractUnitController$1.update(AbstractUnitController.java:130)
    at org.openbase.jul.pattern.AbstractObservable.notifyObservers(AbstractObservable.java:258)
    at org.openbase.jul.pattern.AbstractObservable.notifyObservers(AbstractObservable.java:193)
    at org.openbase.jul.extension.rsb.com.RSBRemoteService.applyDataUpdate(RSBRemoteService.java:1549)
    at org.openbase.jul.extension.rsb.com.RSBRemoteService.applyEventUpdate(RSBRemoteService.java:1202)
    at org.openbase.jul.extension.rsb.com.RSBRemoteService.applyEventUpdate(RSBRemoteService.java:1146)
    at org.openbase.bco.authentication.lib.com.AbstractAuthenticatedRemoteService.access$200(AbstractAuthenticatedRemoteService.java:40)
    at org.openbase.bco.authentication.lib.com.AbstractAuthenticatedRemoteService$AuthenticatedUpdateHandler.internalNotify(AbstractAuthenticatedRemoteService.java:98)
    at rsb.eventprocessing.SingleThreadEventReceivingStrategy$DispatchThread.run(SingleThreadEventReceivingStrategy.java:100)
Caused by: org.openbase.jul.exception.CouldNotPerformException: Could not apply config update!
    at org.openbase.jul.extension.rsb.com.AbstractConfigurableController.applyConfigUpdate(AbstractConfigurableController.java:113)
    at org.openbase.bco.dal.lib.layer.unit.AbstractUnitController.applyConfigUpdate(AbstractUnitController.java:318)
    at org.openbase.bco.dal.lib.layer.unit.AbstractUnitController$1.update(AbstractUnitController.java:136)
    ... 9 common frames omitted
Caused by: org.openbase.jul.exception.CouldNotPerformException: Could not verify scope changes!
    at org.openbase.jul.extension.rsb.com.AbstractConfigurableController.applyConfigUpdate(AbstractConfigurableController.java:108)
    ... 11 common frames omitted
Caused by: org.openbase.jul.exception.InitializationException: Could not initialize class org.openbase.bco.dal.lib.layer.unit.TemperatureControllerController!
    at org.openbase.bco.authentication.lib.com.AbstractAuthenticatedConfigurableController.init(AbstractAuthenticatedConfigurableController.java:56)
    at org.openbase.jul.extension.rsb.com.RSBCommunicationService.init(RSBCommunicationService.java:154)
    at org.openbase.jul.extension.rsb.com.AbstractConfigurableController.applyConfigUpdate(AbstractConfigurableController.java:105)
    ... 11 common frames omitted
Caused by: org.openbase.jul.exception.CouldNotPerformException: Could not register Method[requestDataAuthenticated] on Scope[/home/temperaturecontroller/temperaturregler/ctrl/] of TemperatureControllerController[TEMPERATURE_CONTROLLER[Temperaturregler]]!
    at org.openbase.jul.extension.rsb.com.RPCHelper.registerMethod(RPCHelper.java:125)
    at org.openbase.jul.extension.rsb.com.RPCHelper.registerInterface(RPCHelper.java:58)
    at org.openbase.bco.authentication.lib.com.AbstractAuthenticatedConfigurableController.init(AbstractAuthenticatedConfigurableController.java:54)
    ... 13 common frames omitted
Caused by: org.openbase.jul.exception.CouldNotPerformException: Could not add Method[requestDataAuthenticated]!
    at org.openbase.jul.extension.rsb.com.RSBSynchronizedLocalServer.addMethod(RSBSynchronizedLocalServer.java:124)
    at org.openbase.jul.extension.rsb.com.RPCHelper.registerMethod(RPCHelper.java:67)
    ... 15 common frames omitted
Caused by: java.lang.IllegalArgumentException: A method with name requestDataAuthenticated already exists.
    at rsb.patterns.Server.addMethod(Server.java:200)
    at rsb.patterns.LocalServer.addAndActivate(LocalServer.java:115)
    at rsb.patterns.LocalServer.addMethod(LocalServer.java:91)
    at org.openbase.jul.extension.rsb.com.RSBSynchronizedLocalServer.addMethod(RSBSynchronizedLocalServer.java:118)
    ... 16 common frames omitted
pLeminoq commented 6 years ago

The problem only occurs when a unit host (a device) is changed which causes its hosted unit to change as well. It was caused because the controller of a device de-/activates its hosted units on configuration changes while the hosted units reinitialize themselves. This alone is not problematic because the whole process is synchronized. But the authenticated communication service overwrote the init method and registered a method outside the synchronized environment. Thus the issue was not a duplicated registration of a method which is filtered, but the registration of a method while the server is already active. The issue should be fixed with the following commits: