[
https://issues.apache.org/jira/browse/NIFI-1164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15076117#comment-15076117
]
ASF subversion and git services commented on NIFI-1164:
-------------------------------------------------------
Commit 909c0decd68a54f36eb61f815d10bd34e6a5b862 in nifi's branch
refs/heads/master from [~ozhurakousky]
[ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=909c0de ]
NIFI-1164 Fixed race condition and refactored
Changed ControllerServiceNode by adding enable(..), disable(..) and isActive()
operations. See javadocs for more details in both ControllerServiceNode and
StandardControllerServiceNode
Refactored service enable/disable logic in StandardProcessScheduler and
StandardControllerServiceNode . Below are some of the notes:
- No need for resetting class loader since its going to derive from the class
loader of the service. In other words any classes that aren’t loaded and will
be loaded within the scope of the already loaded service will be loaded by the
class lower of that service
- No need to control 'scheduleState.isScheduled()’ since the logic has changed
to use CAS operation on state update and the service state change is now atomic.
- Removed Thread.sleep(..) and while(true) loop in favor of rescheduling
re-tries achieving better thread utilization since the thread that would
normally block in Thread.sleep(..) is now reused.
- Added tests and validated that the race condition no longer happening
Added additional logic that allows the initiation of the service disabling
while it is in ENABLING state. See javadoc of
StandardProcessScheduler.enable/disable for more details.
NIFI-1164 polishing
> Race condition during initialization of ControllerServices - (part due)
> -----------------------------------------------------------------------
>
> Key: NIFI-1164
> URL: https://issues.apache.org/jira/browse/NIFI-1164
> Project: Apache NiFi
> Issue Type: Bug
> Components: Core Framework
> Affects Versions: 0.3.0
> Reporter: Oleg Zhurakousky
> Assignee: Oleg Zhurakousky
> Fix For: 0.5.0
>
>
> Similar to NIFI-1143, but the exception is happening in the different place
> {code}testConcurrencyWithEnablingReferencingServicesGraph(org.apache.nifi.controller.service.TestStandardControllerServiceProvider)
> Time elapsed: 0.162 sec <<< ERROR!
> java.lang.IllegalStateException: ServiceB[id=4] cannot be enabled because it
> is not disabled
> at
> org.apache.nifi.controller.service.StandardControllerServiceNode.verifyCanEnable(StandardControllerServiceNode.java:183)
> at
> org.apache.nifi.controller.service.StandardControllerServiceProvider.enableReferencingServices(StandardControllerServiceProvider.java:549)
> at
> org.apache.nifi.controller.service.StandardControllerServiceProvider.enableReferencingServices(StandardControllerServiceProvider.java:544)
> at
> org.apache.nifi.controller.service.TestStandardControllerServiceProvider.testEnableReferencingServicesGraph(TestStandardControllerServiceProvider.java:154)
> at
> org.apache.nifi.controller.service.TestStandardControllerServiceProvider.testConcurrencyWithEnablingReferencingServicesGraph(TestStandardControllerServiceProvider.java:124)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)