You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by "Alexei Osipov (JIRA)" <ji...@apache.org> on 2015/04/10 11:55:12 UTC

[jira] [Comment Edited] (CURATOR-208) InterProcessSemaphoreV2 swallows InterruptedException

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

Alexei Osipov edited comment on CURATOR-208 at 4/10/15 9:54 AM:
----------------------------------------------------------------

Suggested code change:
{code}
                try
                {
                    client.delete().guaranteed().forPath(path);
                }
                catch ( KeeperException.NoNodeException e )
                {
                    log.warn("Lease already released", e);
                }
                catch ( InterruptedException e )
                {
                    throw e;
                }
                catch ( Exception e )
                {
                    throw new IOException(e);
                }
{code}


was (Author: alexeiosipov):
Suggested code change:
{code}
                try
                {
                    client.delete().guaranteed().forPath(path);
                }
                catch ( KeeperException.NoNodeException e )
                {
                    log.warn("Lease already released", e);
                }
                catch ( InterruptedException e )
                {
                    throw e;
                }
                catch ( Exception e )
                {
                    throw new IOException(e);
                }
{code}
{code}
                try
                {
                    client.delete().guaranteed().forPath(path);
                }
                catch ( KeeperException.NoNodeException e )
                {
                    log.warn("Lease already released", e);
                }
                catch ( Exception e )
                {
                    throw new IOException(e);
                }
{code}

> InterProcessSemaphoreV2 swallows InterruptedException
> -----------------------------------------------------
>
>                 Key: CURATOR-208
>                 URL: https://issues.apache.org/jira/browse/CURATOR-208
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Recipes
>    Affects Versions: 2.6.0, 2.7.1
>            Reporter: Alexei Osipov
>              Labels: easyfix
>
> {{InterProcessSemaphoreV2}} incorrectly processes {{InterruptedException}}.
> Method `InterProcessSemaphoreV2#makeLease(final String path)` contains code block
> {code}
>                 try
>                 {
>                     client.delete().guaranteed().forPath(path);
>                 }
>                 catch ( KeeperException.NoNodeException e )
>                 {
>                     log.warn("Lease already released", e);
>                 }
>                 catch ( Exception e )
>                 {
>                     throw new IOException(e);
>                 }
> {code}
> The problem is that code in {{try}} block may throw an {{InterruptedException}} and this exception gets wrapped into {{IOException}} so it becomes very problematic to handle it properly.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)