curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Orcun Simsek (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CURATOR-79) InterProcessMutex doesn't clean up after interrupt
Date Wed, 27 Nov 2013 03:27:36 GMT

     [ https://issues.apache.org/jira/browse/CURATOR-79?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Orcun Simsek updated CURATOR-79:
--------------------------------

    Description: 
If the current thread is interrupted while acquiring the InterProcessMutex, a new node for
the lock is created, InterruptException is thrown, and node is not deleted afterwards. Thus
causing a deadlock.

Curator should check the Interrupted state, and do the proper clean up.

{code}
@Test
    public void testInterr() throws Exception {
        CuratorFramework client = CuratorFrameworkFactory.builder()
            .connectString("127.0.0.1:2181")
            .retryPolicy(new RetryNTimes(10, 1000))
            .build();
        client.start();

        Thread.currentThread().interrupt();
        final InterProcessMutex lock = new InterProcessMutex(client, "/testInterruption");

        try {
            lock.acquire();
            lock.release();
        } catch (InterruptedException e) {
            e.printStackTrace();
            if (lock.isAcquiredInThisProcess()) {
                lock.release();
            }
        }

        assertTrue(lock.acquire(10, TimeUnit.MILLISECONDS));
    }
{code}


  was:
If the current thread is interrupted while acquiring the InterProcessMutex, a new node for
the lock is created, InterruptException is thrown, and node is not deleted afterwards. Thus
causing a deadlock.

Curator should check the Interrupted state, and do the proper clean up.



> InterProcessMutex doesn't clean up after interrupt
> --------------------------------------------------
>
>                 Key: CURATOR-79
>                 URL: https://issues.apache.org/jira/browse/CURATOR-79
>             Project: Apache Curator
>          Issue Type: Bug
>            Reporter: Orcun Simsek
>            Assignee: Jordan Zimmerman
>            Priority: Blocker
>
> If the current thread is interrupted while acquiring the InterProcessMutex, a new node
for the lock is created, InterruptException is thrown, and node is not deleted afterwards.
Thus causing a deadlock.
> Curator should check the Interrupted state, and do the proper clean up.
> {code}
> @Test
>     public void testInterr() throws Exception {
>         CuratorFramework client = CuratorFrameworkFactory.builder()
>             .connectString("127.0.0.1:2181")
>             .retryPolicy(new RetryNTimes(10, 1000))
>             .build();
>         client.start();
>         Thread.currentThread().interrupt();
>         final InterProcessMutex lock = new InterProcessMutex(client, "/testInterruption");
>         try {
>             lock.acquire();
>             lock.release();
>         } catch (InterruptedException e) {
>             e.printStackTrace();
>             if (lock.isAcquiredInThisProcess()) {
>                 lock.release();
>             }
>         }
>         assertTrue(lock.acquire(10, TimeUnit.MILLISECONDS));
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message