[ 
https://issues.apache.org/jira/browse/NIFI-1164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15007045#comment-15007045
 ] 

ASF GitHub Bot commented on NIFI-1164:
--------------------------------------

GitHub user olegz opened a pull request:

    https://github.com/apache/nifi/pull/126

    NIFI-1164 decreased the chances of race condition

    Removed checks for 'if (getState() != ControllerServiceState.DISABLED)’ 
from StandardControllerServiceNode.verifyCanEnable(..) operations based on the 
discussion that we had in NIFI-1143 where ‘enablable’ service is the one that 
is not ENABLED or ENABLING.
    On top of that the actual state check is redundant since it is going  to be 
checked again when isValid() is invoked.
    Cleaned up the code in 
StandardControllerServiceProvider.enableReferencingServices(..) since:
    1. It had the same check ordering issue on service state between ENABLING 
and ENABLED as was described in NIFI-1143.
    2. Removed redundant recursiveReferences computation
    3. There was two loops iterating over the same collection, so merged that 
into one
    4. Removed redundant state check in the loop since it would be checked 
again as part of 'verifyCanEnable'

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/olegz/nifi NIFI-1164

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/126.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #126
    
----
commit 54c5c0397c6d45d34c7c75e5fe44984dcb765ea4
Author: Oleg Zhurakousky <[email protected]>
Date:   2015-11-16T18:18:43Z

    NIFI-1164 decreased the chances of race condition
    Removed checks for 'if (getState() != ControllerServiceState.DISABLED)’ 
from StandardControllerServiceNode.verifyCanEnable(..) operations based on the 
discussion that we had in NIFI-1143 where ‘enablable’ service is the one that 
is not ENABLED or ENABLING.
    On top of that the actual state check is redundant since it is going  to be 
checked again when isValid() is invoked.
    Cleaned up the code in 
StandardControllerServiceProvider.enableReferencingServices(..) since:
    1. It had the same check ordering issue on service state between ENABLING 
and ENABLED as was described in NIFI-1143.
    2. Removed redundant recursiveReferences computation
    3. There was two loops iterating over the same collection, so merged that 
into one
    4. Removed redundant state check in the loop since it would be checked 
again as part of 'verifyCanEnable'

----


> 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.4.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)

Reply via email to