You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/06/13 18:57:00 UTC

[jira] [Commented] (ZOOKEEPER-2806) Flaky test: org.apache.zookeeper.server.quorum.FLEBackwardElectionRoundTest.testBackwardElectionRound

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

ASF GitHub Bot commented on ZOOKEEPER-2806:
-------------------------------------------

GitHub user afine opened a pull request:

    https://github.com/apache/zookeeper/pull/280

    ZOOKEEPER-2806: Flaky test: org.apache.zookeeper.server.quorum.FLEBackwardElectionRoundTest.testBackwardElectionRound

    Here is an example of a test failure: https://builds.apache.org/job/ZooKeeper_branch34_jdk8/1016/testReport/org.apache.zookeeper.server.quorum/FLEBackwardElectionRoundTest/testBackwardElectionRound/
    
    This flaky test is caused by the reuse of a `ByteBuffer` object between `QuorumCnxManager`s. 
    
    When sending a `ByteBuffer` we reset its position first:
    
    ```
            synchronized void send(ByteBuffer b) throws IOException {
                byte[] msgBytes = new byte[b.capacity()];
                try {
                    b.position(0);
                    b.get(msgBytes);
                } catch (BufferUnderflowException be) {
                    LOG.error("BufferUnderflowException ", be);
                    return;
                }
                dout.writeInt(b.capacity());
                dout.write(b.array());
                dout.flush();
            }
    ```
    
    `b.get(msgBytes);` changes the position of the `ByteBuffer`. So we can have a race here that results in a `BufferUnderflowException` causing a message never to be sent and this test to fail. 
    
    The fix is to create a new `ByteBuffer` for each message we send in the test.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/afine/zookeeper ZOOKEEPER-2806

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/zookeeper/pull/280.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #280
    
----
commit 384bf271a79333a7d646a74e1e6c326955d7001c
Author: Abraham Fine <ab...@cloudera.com>
Date:   2017-06-13T18:46:48Z

    ZOOKEEPER-2806: Flaky test: org.apache.zookeeper.server.quorum.FLEBackwardElectionRoundTest.testBackwardElectionRound

----


> Flaky test: org.apache.zookeeper.server.quorum.FLEBackwardElectionRoundTest.testBackwardElectionRound
> -----------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-2806
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2806
>             Project: ZooKeeper
>          Issue Type: Bug
>    Affects Versions: 3.4.10, 3.5.3, 3.6.0
>            Reporter: Abraham Fine
>            Assignee: Abraham Fine
>




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)