bookkeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [bookkeeper] branch master updated: Race in PCBC connection if channel inactive before callback
Date Mon, 11 Dec 2017 20:57:59 GMT
This is an automated email from the ASF dual-hosted git repository.

ivank pushed a commit to branch master
in repository

The following commit(s) were added to refs/heads/master by this push:
     new a5ca3a9  Race in PCBC connection if channel inactive before callback
a5ca3a9 is described below

commit a5ca3a9235fecc44e60cca0d46ddb546c2438613
Author: Ivan Kelly <>
AuthorDate: Mon Dec 11 21:57:51 2017 +0100

    Race in PCBC connection if channel inactive before callback
    There's a race in PCBC where if the channel is errored before the
    connection callback occurs, the channel will hang around as a zombie
    This caused a flake in
    TestDisableEnsembleChange#testRetryFailureBookie, but the problem
    itself could affect production code. This test hit it because it tries
    to reconnect in a tight loop as a bookie is booting.
    The error occurs because we only change state with channelInactive if
    the channelInactive occurred on the channel that matches the currently
    assigned If the channel connects successfully, but
    channelInactive occurs before the connect callback runs, the channel
    will be closed, but the state will be transitioned to CONNECTED. No
    more events will occur on the channel, so it'll hang around forever,
    and all requests on the channel will timeout.
    The fix is to check that the channel is active before assigning it to and setting state to CONNECTED. If the channel is not
    active at this point, then the else clause of this block will run
    which closes the channel, and sets state to DISCONNECTED. In this
    case, the next request will trigger a new connection attempt.
    Author: Ivan Kelly <>
    Reviewers: Matteo Merli <>
    This closes #827 from ivankelly/ensemble-flake
 .../main/java/org/apache/bookkeeper/proto/   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/
index c2c8af1..97bdaea 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/
@@ -1911,7 +1911,7 @@ public class PerChannelBookieClient extends ChannelInboundHandlerAdapter
             Queue<GenericCallback<PerChannelBookieClient>> oldPendingOps;
             synchronized (PerChannelBookieClient.this) {
-                if (future.isSuccess() && state == ConnectionState.CONNECTING) {
+                if (future.isSuccess() && state == ConnectionState.CONNECTING && {
           "Successfully connected to bookie: {}",;
                     rc = BKException.Code.OK;
                     channel =;

To stop receiving notification emails like this one, please contact
['"" <>'].

View raw message