You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Patrick Hunt (JIRA)" <ji...@apache.org> on 2008/08/11 20:04:45 UTC

[jira] Created: (ZOOKEEPER-117) threading issues in Leader election

threading issues in Leader election
-----------------------------------

                 Key: ZOOKEEPER-117
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-117
             Project: Zookeeper
          Issue Type: Bug
          Components: server
            Reporter: Patrick Hunt
            Assignee: Flavio Paiva Junqueira


Leader.lead() creates a new thread that can never terminate (short of restarting vm)

naked notifyall in lead() method - what is the condition variable? Best if set inside the sync block


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-117) threading issues in Leader election

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt updated ZOOKEEPER-117:
-----------------------------------

    Attachment: ZOOKEEPER-117.patch

Updated the patch a bit to log in both the expected and unexpected cases.

Note: there is a very small timing issue during shutdown where acceptor may return and result in a handler being added to the followers set, but this will eventually timeout on it's own.

> threading issues in Leader election
> -----------------------------------
>
>                 Key: ZOOKEEPER-117
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-117
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: server
>            Reporter: Patrick Hunt
>            Assignee: Flavio Paiva Junqueira
>         Attachments: ZOOKEEPER-117.patch, ZOOKEEPER-117.patch
>
>
> Leader.lead() creates a new thread that can never terminate (short of restarting vm)
> naked notifyall in lead() method - what is the condition variable? Best if set inside the sync block

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-117) threading issues in Leader election

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt updated ZOOKEEPER-117:
-----------------------------------

    Status: Patch Available  (was: Open)

> threading issues in Leader election
> -----------------------------------
>
>                 Key: ZOOKEEPER-117
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-117
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: server
>            Reporter: Patrick Hunt
>            Assignee: Flavio Paiva Junqueira
>         Attachments: ZOOKEEPER-117.patch
>
>
> Leader.lead() creates a new thread that can never terminate (short of restarting vm)
> naked notifyall in lead() method - what is the condition variable? Best if set inside the sync block

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-117) threading issues in Leader election

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt updated ZOOKEEPER-117:
-----------------------------------

        Fix Version/s: 3.0.0
    Affects Version/s: 3.0.0

> threading issues in Leader election
> -----------------------------------
>
>                 Key: ZOOKEEPER-117
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-117
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.0.0
>            Reporter: Patrick Hunt
>            Assignee: Flavio Paiva Junqueira
>             Fix For: 3.0.0
>
>         Attachments: ZOOKEEPER-117.patch, ZOOKEEPER-117.patch
>
>
> Leader.lead() creates a new thread that can never terminate (short of restarting vm)
> naked notifyall in lead() method - what is the condition variable? Best if set inside the sync block

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-117) threading issues in Leader election

Posted by "Flavio Paiva Junqueira (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Flavio Paiva Junqueira updated ZOOKEEPER-117:
---------------------------------------------

    Attachment: ZOOKEEPER-117.patch

Modification to class FollowerCnxAcceptor to address Pat's comment.

> threading issues in Leader election
> -----------------------------------
>
>                 Key: ZOOKEEPER-117
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-117
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: server
>            Reporter: Patrick Hunt
>            Assignee: Flavio Paiva Junqueira
>         Attachments: ZOOKEEPER-117.patch
>
>
> Leader.lead() creates a new thread that can never terminate (short of restarting vm)
> naked notifyall in lead() method - what is the condition variable? Best if set inside the sync block

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-117) threading issues in Leader election

Posted by "Flavio Paiva Junqueira (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Flavio Paiva Junqueira updated ZOOKEEPER-117:
---------------------------------------------

    Attachment: ZOOKEEPER-117.patch

> threading issues in Leader election
> -----------------------------------
>
>                 Key: ZOOKEEPER-117
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-117
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: server
>            Reporter: Patrick Hunt
>            Assignee: Flavio Paiva Junqueira
>         Attachments: ZOOKEEPER-117.patch
>
>
> Leader.lead() creates a new thread that can never terminate (short of restarting vm)
> naked notifyall in lead() method - what is the condition variable? Best if set inside the sync block

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-117) threading issues in Leader election

Posted by "Benjamin Reed (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benjamin Reed updated ZOOKEEPER-117:
------------------------------------

    Hadoop Flags: [Reviewed]

+1 Looks good

> threading issues in Leader election
> -----------------------------------
>
>                 Key: ZOOKEEPER-117
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-117
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.0.0
>            Reporter: Patrick Hunt
>            Assignee: Flavio Paiva Junqueira
>             Fix For: 3.0.0
>
>         Attachments: ZOOKEEPER-117.patch, ZOOKEEPER-117.patch
>
>
> Leader.lead() creates a new thread that can never terminate (short of restarting vm)
> naked notifyall in lead() method - what is the condition variable? Best if set inside the sync block

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-117) threading issues in Leader election

Posted by "Benjamin Reed (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benjamin Reed updated ZOOKEEPER-117:
------------------------------------

    Resolution: Fixed
        Status: Resolved  (was: Patch Available)

Committed revision 698743.


> threading issues in Leader election
> -----------------------------------
>
>                 Key: ZOOKEEPER-117
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-117
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.0.0
>            Reporter: Patrick Hunt
>            Assignee: Flavio Paiva Junqueira
>             Fix For: 3.0.0
>
>         Attachments: ZOOKEEPER-117.patch, ZOOKEEPER-117.patch
>
>
> Leader.lead() creates a new thread that can never terminate (short of restarting vm)
> naked notifyall in lead() method - what is the condition variable? Best if set inside the sync block

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-117) threading issues in Leader election

Posted by "Flavio Paiva Junqueira (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Flavio Paiva Junqueira updated ZOOKEEPER-117:
---------------------------------------------

    Status: Patch Available  (was: Open)

I have:

1- Created a new class extending thread to handle the connection requests of followers (FollowerCnxAcceptor). An object of this class is shut down when the leader object owning it is shut down;
2- I have removed the naked notify. After inspecting the code, it seems there there is no one waiting on the notification that call generates.

Tests pass without a problem.


> threading issues in Leader election
> -----------------------------------
>
>                 Key: ZOOKEEPER-117
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-117
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: server
>            Reporter: Patrick Hunt
>            Assignee: Flavio Paiva Junqueira
>         Attachments: ZOOKEEPER-117.patch
>
>
> Leader.lead() creates a new thread that can never terminate (short of restarting vm)
> naked notifyall in lead() method - what is the condition variable? Best if set inside the sync block

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-117) threading issues in Leader election

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt updated ZOOKEEPER-117:
-----------------------------------

    Status: Open  (was: Patch Available)

There is a potential race condition with this code:

1) say leader shutdown is called
2) shutdown will call cnxAcceptor.halt()
3) acceptor is currently blocked on accept (for up to 1 sec)
4) shutdown method completes, including shutting down entire followers set (followerhandlers)
5) accept call in acceptor returns true (socket != null)
6) acceptor now adds followerhandler to followers set

> threading issues in Leader election
> -----------------------------------
>
>                 Key: ZOOKEEPER-117
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-117
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: server
>            Reporter: Patrick Hunt
>            Assignee: Flavio Paiva Junqueira
>         Attachments: ZOOKEEPER-117.patch
>
>
> Leader.lead() creates a new thread that can never terminate (short of restarting vm)
> naked notifyall in lead() method - what is the condition variable? Best if set inside the sync block

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-117) threading issues in Leader election

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12634472#action_12634472 ] 

Hudson commented on ZOOKEEPER-117:
----------------------------------

Integrated in ZooKeeper-trunk #94 (See [http://hudson.zones.apache.org/hudson/job/ZooKeeper-trunk/94/])

> threading issues in Leader election
> -----------------------------------
>
>                 Key: ZOOKEEPER-117
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-117
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.0.0
>            Reporter: Patrick Hunt
>            Assignee: Flavio Paiva Junqueira
>             Fix For: 3.0.0
>
>         Attachments: ZOOKEEPER-117.patch, ZOOKEEPER-117.patch
>
>
> Leader.lead() creates a new thread that can never terminate (short of restarting vm)
> naked notifyall in lead() method - what is the condition variable? Best if set inside the sync block

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-117) threading issues in Leader election

Posted by "Flavio Paiva Junqueira (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Flavio Paiva Junqueira updated ZOOKEEPER-117:
---------------------------------------------

    Attachment:     (was: ZOOKEEPER-117.patch)

> threading issues in Leader election
> -----------------------------------
>
>                 Key: ZOOKEEPER-117
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-117
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: server
>            Reporter: Patrick Hunt
>            Assignee: Flavio Paiva Junqueira
>         Attachments: ZOOKEEPER-117.patch
>
>
> Leader.lead() creates a new thread that can never terminate (short of restarting vm)
> naked notifyall in lead() method - what is the condition variable? Best if set inside the sync block

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.