You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Flavio Paiva Junqueira (JIRA)" <ji...@apache.org> on 2008/06/27 17:38:45 UTC

[jira] Created: (ZOOKEEPER-58) Race condition on ClientCnxn.java

Race condition on ClientCnxn.java
---------------------------------

                 Key: ZOOKEEPER-58
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-58
             Project: Zookeeper
          Issue Type: Bug
            Reporter: Flavio Paiva Junqueira


There is a race condition involving the ByteByffer incomingBuffer, a field of ClientCnxn.SendThread. SendThread reads a packet in two steps: first it reads the length of the packet, followed by a read of the packet itself. Each of these steps corresponds to a call to doIO() from the main loop of run(). If there is an exception or the session times out, then it may leave incomingBuffer in an inconsistent state. 

The attached patch adds code to reset incomingBuffer upon a call to SendThread.cleanup(). This method is called upon an exception on run().

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


[jira] Updated: (ZOOKEEPER-58) Race condition on ClientCnxn.java

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

Flavio Paiva Junqueira updated ZOOKEEPER-58:
--------------------------------------------

    Attachment:     (was: patch-incoming-race.txt)

> Race condition on ClientCnxn.java
> ---------------------------------
>
>                 Key: ZOOKEEPER-58
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-58
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: java client
>            Reporter: Flavio Paiva Junqueira
>            Assignee: Flavio Paiva Junqueira
>         Attachments: patch-incoming-race.txt
>
>
> There is a race condition involving the ByteByffer incomingBuffer, a field of ClientCnxn.SendThread. SendThread reads a packet in two steps: first it reads the length of the packet, followed by a read of the packet itself. Each of these steps corresponds to a call to doIO() from the main loop of run(). If there is an exception or the session times out, then it may leave incomingBuffer in an inconsistent state. 
> The attached patch adds code to reset incomingBuffer upon a call to SendThread.cleanup(). This method is called upon an exception on run().

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


[jira] Updated: (ZOOKEEPER-58) Race condition on ClientCnxn.java

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

Flavio Paiva Junqueira updated ZOOKEEPER-58:
--------------------------------------------

    Attachment:     (was: patch-incoming-race.txt)

> Race condition on ClientCnxn.java
> ---------------------------------
>
>                 Key: ZOOKEEPER-58
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-58
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: java client
>            Reporter: Flavio Paiva Junqueira
>            Assignee: Flavio Paiva Junqueira
>         Attachments: ZOOKEEPER-58.patch
>
>
> There is a race condition involving the ByteByffer incomingBuffer, a field of ClientCnxn.SendThread. SendThread reads a packet in two steps: first it reads the length of the packet, followed by a read of the packet itself. Each of these steps corresponds to a call to doIO() from the main loop of run(). If there is an exception or the session times out, then it may leave incomingBuffer in an inconsistent state. 
> The attached patch adds code to reset incomingBuffer upon a call to SendThread.cleanup(). This method is called upon an exception on run().

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


[jira] Updated: (ZOOKEEPER-58) Race condition on ClientCnxn.java

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

Flavio Paiva Junqueira updated ZOOKEEPER-58:
--------------------------------------------

    Component/s: java client

> Race condition on ClientCnxn.java
> ---------------------------------
>
>                 Key: ZOOKEEPER-58
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-58
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: java client
>            Reporter: Flavio Paiva Junqueira
>         Attachments: patch-incoming-race.txt
>
>
> There is a race condition involving the ByteByffer incomingBuffer, a field of ClientCnxn.SendThread. SendThread reads a packet in two steps: first it reads the length of the packet, followed by a read of the packet itself. Each of these steps corresponds to a call to doIO() from the main loop of run(). If there is an exception or the session times out, then it may leave incomingBuffer in an inconsistent state. 
> The attached patch adds code to reset incomingBuffer upon a call to SendThread.cleanup(). This method is called upon an exception on run().

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


[jira] Assigned: (ZOOKEEPER-58) Race condition on ClientCnxn.java

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

Flavio Paiva Junqueira reassigned ZOOKEEPER-58:
-----------------------------------------------

    Assignee: Benjamin Reed  (was: Flavio Paiva Junqueira)

Ben, you have reviewed this patch before, but since I have regenerated it against the apache trunk, you have to review it again.

> Race condition on ClientCnxn.java
> ---------------------------------
>
>                 Key: ZOOKEEPER-58
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-58
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: java client
>            Reporter: Flavio Paiva Junqueira
>            Assignee: Benjamin Reed
>         Attachments: ZOOKEEPER-58.patch
>
>
> There is a race condition involving the ByteByffer incomingBuffer, a field of ClientCnxn.SendThread. SendThread reads a packet in two steps: first it reads the length of the packet, followed by a read of the packet itself. Each of these steps corresponds to a call to doIO() from the main loop of run(). If there is an exception or the session times out, then it may leave incomingBuffer in an inconsistent state. 
> The attached patch adds code to reset incomingBuffer upon a call to SendThread.cleanup(). This method is called upon an exception on run().

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


[jira] Commented: (ZOOKEEPER-58) Race condition on ClientCnxn.java

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

Benjamin Reed commented on ZOOKEEPER-58:
----------------------------------------

+1

> Race condition on ClientCnxn.java
> ---------------------------------
>
>                 Key: ZOOKEEPER-58
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-58
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: java client
>            Reporter: Flavio Paiva Junqueira
>            Assignee: Benjamin Reed
>         Attachments: ZOOKEEPER-58.patch
>
>
> There is a race condition involving the ByteByffer incomingBuffer, a field of ClientCnxn.SendThread. SendThread reads a packet in two steps: first it reads the length of the packet, followed by a read of the packet itself. Each of these steps corresponds to a call to doIO() from the main loop of run(). If there is an exception or the session times out, then it may leave incomingBuffer in an inconsistent state. 
> The attached patch adds code to reset incomingBuffer upon a call to SendThread.cleanup(). This method is called upon an exception on run().

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


[jira] Updated: (ZOOKEEPER-58) Race condition on ClientCnxn.java

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

james strachan updated ZOOKEEPER-58:
------------------------------------

    Status: Patch Available  (was: Open)

just marking this issue as having a patch - does a committer fancy applying it? :)

> Race condition on ClientCnxn.java
> ---------------------------------
>
>                 Key: ZOOKEEPER-58
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-58
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: java client
>            Reporter: Flavio Paiva Junqueira
>            Assignee: Flavio Paiva Junqueira
>         Attachments: patch-incoming-race.txt
>
>
> There is a race condition involving the ByteByffer incomingBuffer, a field of ClientCnxn.SendThread. SendThread reads a packet in two steps: first it reads the length of the packet, followed by a read of the packet itself. Each of these steps corresponds to a call to doIO() from the main loop of run(). If there is an exception or the session times out, then it may leave incomingBuffer in an inconsistent state. 
> The attached patch adds code to reset incomingBuffer upon a call to SendThread.cleanup(). This method is called upon an exception on run().

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


[jira] Issue Comment Edited: (ZOOKEEPER-58) Race condition on ClientCnxn.java

Posted by "Flavio Paiva Junqueira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-58?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12609000#action_12609000 ] 

fpj edited comment on ZOOKEEPER-58 at 6/28/08 4:39 AM:
--------------------------------------------------------------------------

New patch, moved added code to startConnect().

      was (Author: fpj):
    New patch
  
> Race condition on ClientCnxn.java
> ---------------------------------
>
>                 Key: ZOOKEEPER-58
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-58
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: java client
>            Reporter: Flavio Paiva Junqueira
>            Assignee: Flavio Paiva Junqueira
>         Attachments: patch-incoming-race.txt
>
>
> There is a race condition involving the ByteByffer incomingBuffer, a field of ClientCnxn.SendThread. SendThread reads a packet in two steps: first it reads the length of the packet, followed by a read of the packet itself. Each of these steps corresponds to a call to doIO() from the main loop of run(). If there is an exception or the session times out, then it may leave incomingBuffer in an inconsistent state. 
> The attached patch adds code to reset incomingBuffer upon a call to SendThread.cleanup(). This method is called upon an exception on run().

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


[jira] Updated: (ZOOKEEPER-58) Race condition on ClientCnxn.java

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

Flavio Paiva Junqueira updated ZOOKEEPER-58:
--------------------------------------------

    Attachment:     (was: patch-incoming-race.txt)

> Race condition on ClientCnxn.java
> ---------------------------------
>
>                 Key: ZOOKEEPER-58
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-58
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: java client
>            Reporter: Flavio Paiva Junqueira
>            Assignee: Flavio Paiva Junqueira
>         Attachments: patch-incoming-race.txt
>
>
> There is a race condition involving the ByteByffer incomingBuffer, a field of ClientCnxn.SendThread. SendThread reads a packet in two steps: first it reads the length of the packet, followed by a read of the packet itself. Each of these steps corresponds to a call to doIO() from the main loop of run(). If there is an exception or the session times out, then it may leave incomingBuffer in an inconsistent state. 
> The attached patch adds code to reset incomingBuffer upon a call to SendThread.cleanup(). This method is called upon an exception on run().

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


[jira] Updated: (ZOOKEEPER-58) Race condition on ClientCnxn.java

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

Flavio Paiva Junqueira updated ZOOKEEPER-58:
--------------------------------------------

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

Committed

> Race condition on ClientCnxn.java
> ---------------------------------
>
>                 Key: ZOOKEEPER-58
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-58
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: java client
>            Reporter: Flavio Paiva Junqueira
>            Assignee: Benjamin Reed
>         Attachments: ZOOKEEPER-58.patch
>
>
> There is a race condition involving the ByteByffer incomingBuffer, a field of ClientCnxn.SendThread. SendThread reads a packet in two steps: first it reads the length of the packet, followed by a read of the packet itself. Each of these steps corresponds to a call to doIO() from the main loop of run(). If there is an exception or the session times out, then it may leave incomingBuffer in an inconsistent state. 
> The attached patch adds code to reset incomingBuffer upon a call to SendThread.cleanup(). This method is called upon an exception on run().

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


[jira] Updated: (ZOOKEEPER-58) Race condition on ClientCnxn.java

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

Flavio Paiva Junqueira updated ZOOKEEPER-58:
--------------------------------------------

    Attachment: ZOOKEEPER-58.patch

Adding new patch generated against the apache trunk.

> Race condition on ClientCnxn.java
> ---------------------------------
>
>                 Key: ZOOKEEPER-58
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-58
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: java client
>            Reporter: Flavio Paiva Junqueira
>            Assignee: Flavio Paiva Junqueira
>         Attachments: ZOOKEEPER-58.patch
>
>
> There is a race condition involving the ByteByffer incomingBuffer, a field of ClientCnxn.SendThread. SendThread reads a packet in two steps: first it reads the length of the packet, followed by a read of the packet itself. Each of these steps corresponds to a call to doIO() from the main loop of run(). If there is an exception or the session times out, then it may leave incomingBuffer in an inconsistent state. 
> The attached patch adds code to reset incomingBuffer upon a call to SendThread.cleanup(). This method is called upon an exception on run().

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


[jira] Assigned: (ZOOKEEPER-58) Race condition on ClientCnxn.java

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

Mahadev konar reassigned ZOOKEEPER-58:
--------------------------------------

    Assignee: Flavio Paiva Junqueira

> Race condition on ClientCnxn.java
> ---------------------------------
>
>                 Key: ZOOKEEPER-58
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-58
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: java client
>            Reporter: Flavio Paiva Junqueira
>            Assignee: Flavio Paiva Junqueira
>         Attachments: patch-incoming-race.txt
>
>
> There is a race condition involving the ByteByffer incomingBuffer, a field of ClientCnxn.SendThread. SendThread reads a packet in two steps: first it reads the length of the packet, followed by a read of the packet itself. Each of these steps corresponds to a call to doIO() from the main loop of run(). If there is an exception or the session times out, then it may leave incomingBuffer in an inconsistent state. 
> The attached patch adds code to reset incomingBuffer upon a call to SendThread.cleanup(). This method is called upon an exception on run().

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


[jira] Commented: (ZOOKEEPER-58) Race condition on ClientCnxn.java

Posted by "Flavio Paiva Junqueira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-58?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12616521#action_12616521 ] 

Flavio Paiva Junqueira commented on ZOOKEEPER-58:
-------------------------------------------------

yeah, right, I'll take care of it... :-)


> Race condition on ClientCnxn.java
> ---------------------------------
>
>                 Key: ZOOKEEPER-58
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-58
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: java client
>            Reporter: Flavio Paiva Junqueira
>            Assignee: Flavio Paiva Junqueira
>         Attachments: patch-incoming-race.txt
>
>
> There is a race condition involving the ByteByffer incomingBuffer, a field of ClientCnxn.SendThread. SendThread reads a packet in two steps: first it reads the length of the packet, followed by a read of the packet itself. Each of these steps corresponds to a call to doIO() from the main loop of run(). If there is an exception or the session times out, then it may leave incomingBuffer in an inconsistent state. 
> The attached patch adds code to reset incomingBuffer upon a call to SendThread.cleanup(). This method is called upon an exception on run().

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


[jira] Commented: (ZOOKEEPER-58) Race condition on ClientCnxn.java

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

Benjamin Reed commented on ZOOKEEPER-58:
----------------------------------------

Excellent catch! I think it is better to do this in either primeConnection or startConnect, that way we make sure everything is setup correctly at the start rather than trying to make sure that we clean up correctly. Of the two my preference would probably be startConnect.

> Race condition on ClientCnxn.java
> ---------------------------------
>
>                 Key: ZOOKEEPER-58
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-58
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: java client
>            Reporter: Flavio Paiva Junqueira
>         Attachments: patch-incoming-race.txt
>
>
> There is a race condition involving the ByteByffer incomingBuffer, a field of ClientCnxn.SendThread. SendThread reads a packet in two steps: first it reads the length of the packet, followed by a read of the packet itself. Each of these steps corresponds to a call to doIO() from the main loop of run(). If there is an exception or the session times out, then it may leave incomingBuffer in an inconsistent state. 
> The attached patch adds code to reset incomingBuffer upon a call to SendThread.cleanup(). This method is called upon an exception on run().

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


[jira] Updated: (ZOOKEEPER-58) Race condition on ClientCnxn.java

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

Flavio Paiva Junqueira updated ZOOKEEPER-58:
--------------------------------------------

    Attachment: patch-incoming-race.txt

> Race condition on ClientCnxn.java
> ---------------------------------
>
>                 Key: ZOOKEEPER-58
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-58
>             Project: Zookeeper
>          Issue Type: Bug
>            Reporter: Flavio Paiva Junqueira
>         Attachments: patch-incoming-race.txt
>
>
> There is a race condition involving the ByteByffer incomingBuffer, a field of ClientCnxn.SendThread. SendThread reads a packet in two steps: first it reads the length of the packet, followed by a read of the packet itself. Each of these steps corresponds to a call to doIO() from the main loop of run(). If there is an exception or the session times out, then it may leave incomingBuffer in an inconsistent state. 
> The attached patch adds code to reset incomingBuffer upon a call to SendThread.cleanup(). This method is called upon an exception on run().

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


[jira] Commented: (ZOOKEEPER-58) Race condition on ClientCnxn.java

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

Benjamin Reed commented on ZOOKEEPER-58:
----------------------------------------

+1 Looks good

> Race condition on ClientCnxn.java
> ---------------------------------
>
>                 Key: ZOOKEEPER-58
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-58
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: java client
>            Reporter: Flavio Paiva Junqueira
>            Assignee: Flavio Paiva Junqueira
>         Attachments: patch-incoming-race.txt
>
>
> There is a race condition involving the ByteByffer incomingBuffer, a field of ClientCnxn.SendThread. SendThread reads a packet in two steps: first it reads the length of the packet, followed by a read of the packet itself. Each of these steps corresponds to a call to doIO() from the main loop of run(). If there is an exception or the session times out, then it may leave incomingBuffer in an inconsistent state. 
> The attached patch adds code to reset incomingBuffer upon a call to SendThread.cleanup(). This method is called upon an exception on run().

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


[jira] Updated: (ZOOKEEPER-58) Race condition on ClientCnxn.java

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

Patrick Hunt updated ZOOKEEPER-58:
----------------------------------

    Fix Version/s: 3.0.0

> Race condition on ClientCnxn.java
> ---------------------------------
>
>                 Key: ZOOKEEPER-58
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-58
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: java client
>            Reporter: Flavio Paiva Junqueira
>            Assignee: Benjamin Reed
>             Fix For: 3.0.0
>
>         Attachments: ZOOKEEPER-58.patch
>
>
> There is a race condition involving the ByteByffer incomingBuffer, a field of ClientCnxn.SendThread. SendThread reads a packet in two steps: first it reads the length of the packet, followed by a read of the packet itself. Each of these steps corresponds to a call to doIO() from the main loop of run(). If there is an exception or the session times out, then it may leave incomingBuffer in an inconsistent state. 
> The attached patch adds code to reset incomingBuffer upon a call to SendThread.cleanup(). This method is called upon an exception on run().

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


[jira] Updated: (ZOOKEEPER-58) Race condition on ClientCnxn.java

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

Flavio Paiva Junqueira updated ZOOKEEPER-58:
--------------------------------------------

    Attachment: patch-incoming-race.txt

New patch

> Race condition on ClientCnxn.java
> ---------------------------------
>
>                 Key: ZOOKEEPER-58
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-58
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: java client
>            Reporter: Flavio Paiva Junqueira
>            Assignee: Flavio Paiva Junqueira
>         Attachments: patch-incoming-race.txt
>
>
> There is a race condition involving the ByteByffer incomingBuffer, a field of ClientCnxn.SendThread. SendThread reads a packet in two steps: first it reads the length of the packet, followed by a read of the packet itself. Each of these steps corresponds to a call to doIO() from the main loop of run(). If there is an exception or the session times out, then it may leave incomingBuffer in an inconsistent state. 
> The attached patch adds code to reset incomingBuffer upon a call to SendThread.cleanup(). This method is called upon an exception on run().

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


[jira] Updated: (ZOOKEEPER-58) Race condition on ClientCnxn.java

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

Flavio Paiva Junqueira updated ZOOKEEPER-58:
--------------------------------------------

    Attachment: patch-incoming-race.txt

> Race condition on ClientCnxn.java
> ---------------------------------
>
>                 Key: ZOOKEEPER-58
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-58
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: java client
>            Reporter: Flavio Paiva Junqueira
>            Assignee: Flavio Paiva Junqueira
>         Attachments: patch-incoming-race.txt
>
>
> There is a race condition involving the ByteByffer incomingBuffer, a field of ClientCnxn.SendThread. SendThread reads a packet in two steps: first it reads the length of the packet, followed by a read of the packet itself. Each of these steps corresponds to a call to doIO() from the main loop of run(). If there is an exception or the session times out, then it may leave incomingBuffer in an inconsistent state. 
> The attached patch adds code to reset incomingBuffer upon a call to SendThread.cleanup(). This method is called upon an exception on run().

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