curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CURATOR-126) IllegalStateException in performBackgroundOperation during close
Date Mon, 28 Jul 2014 19:04:41 GMT

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

ASF GitHub Bot commented on CURATOR-126:
----------------------------------------

Github user dragonsinth commented on a diff in the pull request:

    https://github.com/apache/curator/pull/23#discussion_r15483096
  
    --- Diff: curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
---
    @@ -722,39 +725,35 @@ public void retriesExhausted(OperationAndData<String> operationAndData)
     
         private <DATA_TYPE> void handleBackgroundOperationException(OperationAndData<DATA_TYPE>
operationAndData, Throwable e)
         {
    -        do
    +        if ( (operationAndData != null) && RetryLoop.isRetryException(e) )
             {
    -            if ( (operationAndData != null) && RetryLoop.isRetryException(e)
)
    +            if ( !Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES)
)
    +            {
    +                log.debug("Retry-able exception received", e);
    +            }
    +            if ( client.getRetryPolicy().allowRetry(operationAndData.getThenIncrementRetryCount(),
operationAndData.getElapsedTimeMs(), operationAndData) )
                 {
                     if ( !Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES)
)
                     {
    -                    log.debug("Retry-able exception received", e);
    +                    log.debug("Retrying operation");
                     }
    -                if ( client.getRetryPolicy().allowRetry(operationAndData.getThenIncrementRetryCount(),
operationAndData.getElapsedTimeMs(), operationAndData) )
    +                backgroundOperations.offer(operationAndData);
    +                return;
    +            }
    +            else
    +            {
    +                if ( !Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES)
)
                     {
    -                    if ( !Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES)
)
    -                    {
    -                        log.debug("Retrying operation");
    -                    }
    -                    backgroundOperations.offer(operationAndData);
    -                    break;
    +                    log.debug("Retry policy did not allow retry");
                     }
    -                else
    +                if ( operationAndData.getErrorCallback() != null )
                     {
    -                    if ( !Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES)
)
    -                    {
    -                        log.debug("Retry policy did not allow retry");
    -                    }
    -                    if ( operationAndData.getErrorCallback() != null )
    -                    {
    -                        operationAndData.getErrorCallback().retriesExhausted(operationAndData);
    -                    }
    +                    operationAndData.getErrorCallback().retriesExhausted(operationAndData);
                     }
                 }
    -
    -            logError("Background exception was not retry-able or retry gave up", e);
             }
    -        while ( false );
    +
    +        logError("Background exception was not retry-able or retry gave up", e);
    --- End diff --
    
    This is unrelated to the main change.  While I was in here, I noticed this method was
more complicated than it needed to be.  I could revert this section if you guys would prefer
to isolate changes.


> IllegalStateException in performBackgroundOperation during close
> ----------------------------------------------------------------
>
>                 Key: CURATOR-126
>                 URL: https://issues.apache.org/jira/browse/CURATOR-126
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 2.5.0
>            Reporter: Scott Blum
>            Assignee: Cameron McKenzie
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> {code}
> [CuratorFramework-0] ERROR org.apache.curator.framework.imps.CuratorFrameworkImpl  -
Background exception was not retry-able or retry gave up
> java.lang.IllegalStateException: Client is not started
> 	at com.google.common.base.Preconditions.checkState(Preconditions.java:176)
> 	at org.apache.curator.CuratorZookeeperClient.getZooKeeper(CuratorZookeeperClient.java:113)
> 	at org.apache.curator.framework.imps.CuratorFrameworkImpl.performBackgroundOperation(CuratorFrameworkImpl.java:807)
> 	at org.apache.curator.framework.imps.CuratorFrameworkImpl.backgroundOperationsLoop(CuratorFrameworkImpl.java:793)
> 	at org.apache.curator.framework.imps.CuratorFrameworkImpl.access$400(CuratorFrameworkImpl.java:57)
> 	at org.apache.curator.framework.imps.CuratorFrameworkImpl$4.call(CuratorFrameworkImpl.java:275)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> 	at java.lang.Thread.run(Thread.java:744)
> {code}
> I see this sometimes during test runs; I believe this happens because CuratorZookeeperClient.started
gets set to false during shutdown, but the backgroundOperation loop can still be running since
shutting down the backgroundOperation loop is inherently racy.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message