You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bookkeeper.apache.org by "Ivan Kelly (JIRA)" <ji...@apache.org> on 2012/06/01 11:42:24 UTC

[jira] [Created] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

Ivan Kelly created BOOKKEEPER-281:
-------------------------------------

             Summary: BKClient is failing when zkclient connection delays
                 Key: BOOKKEEPER-281
                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
             Project: Bookkeeper
          Issue Type: Bug
            Reporter: Ivan Kelly
            Assignee: Ivan Kelly
             Fix For: 4.1.0


I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.



12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
       at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
       at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
       at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
       at BKClient1.main(BKClient1.java:40)
12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.



When analyzed more, the root cause is:

BookKeeper.java:
--------------------
In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.

I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

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

Ivan Kelly updated BOOKKEEPER-281:
----------------------------------

    Fix Version/s: 4.2.0
    
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

Posted by "Ivan Kelly (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13288422#comment-13288422 ] 

Ivan Kelly commented on BOOKKEEPER-281:
---------------------------------------

In that case, if we receive a non connected handle we should fail straight away. For BookKeeperAdmin, I may need to refactor to ensure that it passes in a connected handle.
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

Posted by "Ivan Kelly (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13288548#comment-13288548 ] 

Ivan Kelly commented on BOOKKEEPER-281:
---------------------------------------

ZooKeeper usage is definitely another issue. I've created BOOKKEEPER-284 for this.

@Sijie
The countDown for all events assumes that the first event from ZooKeeper will be a connection event. This will either be SyncConnected or Disconnected. In either case, in the following if statement, we check if the zk client is connected, and if not throw an exception. 
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

Posted by "Sijie Guo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13287811#comment-13287811 ] 

Sijie Guo commented on BOOKKEEPER-281:
--------------------------------------

Thanks Ivan. the patch seems good. but I had two questions need your clarification.

1)
{code}
-        Thread.sleep((baseClientConf.getReadTimeout()*2)*1000);
+        Thread.sleep((baseClientConf.getReadTimeout()*3)*1000);
{code}
why you change it from 2 to 3?


2)
{code}
+        bookieWatcher = new BookieWatcher(conf, this);
+        
+        // assume that a passed in zk is already connected
+        bootstrapWithZK();
{code}

in BookKeeper constructor with passed zk instance, you assumed that the passed zk instance is already connected. By in BookKeeperAdmin, the passed zk instance doesn't wait until connected to construct a bookkeeper instance. so BookKeeperAdmin would encounter same issue when zk connection delays.


                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

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

Flavio Junqueira commented on BOOKKEEPER-281:
---------------------------------------------

bq. Regarding state notifications, I think this is a bad idea. A user of the api shouldn't need to know if the client is ready to use or not. They should be able to just submit an async request to the client, and either the client does it and completes with success or failure due to an unrecoverable error state.

These are independent paths. If the application wants, it can wait until it is connected. If it doesn't check and it submits operations, then its operations might fail as you say.

bq. The user isn't going to check the state and, on seeing that the client isn't connected, decide that it doesn't want to add an entry. 

Adding an entry is probably not a good example because it doesn't depend on zookeeper in a regular run. Creating/Closing a ledger are perhaps more relevant, no? In any case, I see that as being useful, since an application might not want to submit a whole bunch of asynchronous operations to later find that none of them went through. It's true that it can happen independent of the case we are discussing here, but under the conditions we are discussing here, the application could know that it is better ti wait if we notify.  

bq. My biggest problem with the ZooKeeper api is that it doesn't allow a user to submit an async request without having to ensure that its in connected state. The api is supposed to hide these kind of details. 

If the client session is expired, then we can't guarantee ordering. If we don't fail the operations, then we might end up violating our ordering guarantees.  

bq. In fact, the HBase guys wrapped the whole zookeeper api to get around this problem[1]. I think, in 4.2 we should perhaps take a similar approach.

I haven't looked at the particular repository you pointed us to, but in general I find embedding zookeeper, trying to make its use completely transparent, a bad idea. If it is a separate component, it is best for debugging that the developer is aware.   
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

Posted by "Rakesh R (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13289151#comment-13289151 ] 

Rakesh R commented on BOOKKEEPER-281:
-------------------------------------

+1, latest patch looks nice for me.
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

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

Flavio Junqueira commented on BOOKKEEPER-281:
---------------------------------------------

bq. Passing the exception back would require waiting for the exception to occur, i.e. blocking. If this is acceptable, we would be better off just making the whole BookKeeper constructor to be blocking (I'm considering this as a possible solution).

Since this is an initialization step, I find it acceptable to block. But, my preference, which seem to be a bit tight to do for this patch, is perhaps to implement a simple state machine and notify the application as the state changes. For example, we can notify the application when the object is ready (state READY) and when it loses its session to zk (state DISCONNECTED_FROM_ZK).

                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

Posted by "Sijie Guo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13288609#comment-13288609 ] 

Sijie Guo commented on BOOKKEEPER-281:
--------------------------------------

@Ivan @Uma, thanks for explanation. My origin concern is that the countDownLatch will be called each time receiving a event from ZooKeeper. It might heart performance. Looking into the source code of CountDownLatch, seems it returns immediately if the count has reached zero. So the new patch is OK for me. +1.
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

Posted by "Sijie Guo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13288540#comment-13288540 ] 

Sijie Guo commented on BOOKKEEPER-281:
--------------------------------------

agreed that a separated jira on how to deal with zookeeper.

@Ivan, the new patch is simple and clear. just one question, why you change to count down the latch on all events? is there any consideration?

{code}
-                        if (event.getState().equals(Watcher.Event.KeeperState.SyncConnected)) {
-                            connectLatch.countDown();
-                        }
+                        // countdown the latch on all events, even if we haven't
+                        // successfully connected.
+                        zkConnectLatch.countDown();
+
{code}

{code}
         zk = new ZooKeeper(conf.getZkServers(), conf.getZkTimeout(), new Watcher() {
             @Override
             public void process(WatchedEvent event) {
+                latch.countDown();
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("Process: " + event.getType() + " " + event.getPath());
                 }
             }
         });
{code}
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

Posted by "Sijie Guo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13289172#comment-13289172 ] 

Sijie Guo commented on BOOKKEEPER-281:
--------------------------------------

we had three +1 on it. I would commit it.
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

Posted by "Ivan Kelly (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13287328#comment-13287328 ] 

Ivan Kelly commented on BOOKKEEPER-281:
---------------------------------------

ignore, fails a test.
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0
>
>         Attachments: BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

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

Hudson commented on BOOKKEEPER-281:
-----------------------------------

Integrated in bookkeeper-trunk #543 (See [https://builds.apache.org/job/bookkeeper-trunk/543/])
    BOOKKEEPER-281: BKClient is failing when zkclient connection delays (ivank via sijie) (Revision 1346247)

     Result = SUCCESS
sijie : 
Files : 
* /zookeeper/bookkeeper/trunk/CHANGES.txt
* /zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookKeeper.java
* /zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookKeeperAdmin.java
* /zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieWatcher.java
* /zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperTest.java
* /zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/TestReadTimeout.java
* /zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/ZooKeeperUtil.java

                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

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

Flavio Junqueira commented on BOOKKEEPER-281:
---------------------------------------------

Let me also mention that this is possibly a longer discussion that we possibly don't want to have now. I suggest we try to wrap up the patch for this issue and leave a discussion on how to deal with zookeeper for a later release.
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

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

Flavio Junqueira commented on BOOKKEEPER-281:
---------------------------------------------

+1, looks good.
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

Posted by "Ivan Kelly (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13288487#comment-13288487 ] 

Ivan Kelly commented on BOOKKEEPER-281:
---------------------------------------

Regarding state notifications, I think this is a bad idea. A user of the api shouldn't need to know if the client is ready to use or not. They should be able to just submit an async request to the client, and either the client does it and completes with success or failure due to an unrecoverable error state. The user isn't going to check the state and, on seeing that the client isn't connected, decide that it doesn't want to add an entry. My biggest problem with the ZooKeeper api is that it doesn't allow a user to submit an async request without having to ensure that its in connected state. The api is supposed to hide these kind of details. In fact, the HBase guys wrapped the whole zookeeper api to get around this problem[1]. I think, in 4.2 we should perhaps take a similar approach.

[1] https://github.com/apache/hbase/blob/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

Posted by "Uma Maheswara Rao G (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13288550#comment-13288550 ] 

Uma Maheswara Rao G commented on BOOKKEEPER-281:
------------------------------------------------

@Sijie,
 I think Ivan's idea is coundown on all the events and later have a check on isConnected. If clinet gets some event means, connection might established and got the event. if connection is not in a connected state he is throwing exception. Please correct me Ivan if my understanding is wrong.

Patch looks good for me.  +1 from my side on answering to Sijie's queries.

                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

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

Ivan Kelly updated BOOKKEEPER-281:
----------------------------------

    Attachment: BOOKKEEPER-281.diff

New patch makes makes BookKeeper client constructor block until zookeeper has connected. This will effectively be the same behaviour as before as we always called readBookiesBlocking in the constructors anyhow.
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

Posted by "Ivan Kelly (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13288405#comment-13288405 ] 

Ivan Kelly commented on BOOKKEEPER-281:
---------------------------------------

@Sijie
1. This is a change to fix a intermittent failure of the test, due to the change in how BOOKKEEPER-258 made timeouts work. Before 258, we set the timeout and when it hit, we just killed everything. Now we set the timeout, and when it triggers, we check if that amount of time has passed with the request outstanding and if so error the request. As the timeout timer is set on the connection and not the individual requests, and the requests can be made a couple of ms after the connection is set up, sometimes it can take 2 timeout periods for the requests to be timed out. This change ensures that this happens.

2. This is true. I think the overall problem here is that its not possible to set a Watcher on a ZooKeeper without overriding the previous one. This means that there's no real clean way to say "Don't process anything on this zk until it has connected". 

@Rakesh
1. I'll look into how best to fail fast and generate a new patch.
2. Passing the exception back would require waiting for the exception to occur, i.e. blocking. If this is acceptable, we would be better off just making the whole BookKeeper constructor to be blocking (I'm considering this as a possible solution).
3. Same answer as 2.
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

Posted by "Uma Maheswara Rao G (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13288556#comment-13288556 ] 

Uma Maheswara Rao G commented on BOOKKEEPER-281:
------------------------------------------------

Oh, thanks Ivan. Comment overlap...Did not see your comment above. :-)
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

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

Ivan Kelly updated BOOKKEEPER-281:
----------------------------------

    Attachment: BOOKKEEPER-281.diff

Patch defers initialization of any zk dependent part until after sync connected has been received.

test included
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0
>
>         Attachments: BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

Posted by "Rakesh R (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13288461#comment-13288461 ] 

Rakesh R commented on BOOKKEEPER-281:
-------------------------------------

@Ivan
bq.  Passing the exception back would require waiting for the exception to occur, i.e. blocking

Here I'm just thinking about the application side logic, how does the user knows about the bkclient is ready to use?. 
I also feel a similar approach like state notification would be good(Flavio's suggestion).
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

Posted by "Rakesh R (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13287846#comment-13287846 ] 

Rakesh R commented on BOOKKEEPER-281:
-------------------------------------

Nice work. Just few thoughts:

# Consider the case ZK server not running and fails, should we now wait for the full session timeout? IMHO, the latch should listen either SyncConnected or Disconnected events. 
# BookKeeper(final ClientConfiguration conf) is not throwing timeout/interrupted exception back to the client. I feel, would great pass exceptions back to the client. How does it sound?
# Also, earlier I guess BookKeeper(conf) was throwing the following exception back to the client, but in the patch it is suppressing. Any thoughts on this?
{noformat}
+        } catch (KeeperException ke) {
+            LOG.error("Exception accessing zookeeper", ke);
+        } catch (IOException ioe) {
+            LOG.error("I/O exception accessing zookeeper", ioe);
+        } catch (InterruptedException ie) {
+            LOG.error("Interrupted accessing zookeeper", ie);
+        }
{noformat}
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

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

Flavio Junqueira commented on BOOKKEEPER-281:
---------------------------------------------

bq. in BookKeeper constructor with passed zk instance, you assumed that the passed zk instance is already connected. By in BookKeeperAdmin, the passed zk instance doesn't wait until connected to construct a bookkeeper instance. so BookKeeperAdmin would encounter same issue when zk connection delays.

Assuming that the zk instance is already connected seems reasonable to me. The underlying assumption is that the application which passed the zk instance is responsible for passing a working zk handle. In the case the application passes the zk handle, I'm not sure it is a good idea to have the bk client sort of managing it.
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

Posted by "Sijie Guo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13288426#comment-13288426 ] 

Sijie Guo commented on BOOKKEEPER-281:
--------------------------------------

> In that case, if we receive a non connected handle we should fail straight away. For BookKeeperAdmin, I may need to refactor to ensure that it passes in a connected handle.

yes. we need to ensure zookeeper handle is connected in BookKeeperAdmin. :)
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

Posted by "Sijie Guo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13288428#comment-13288428 ] 

Sijie Guo commented on BOOKKEEPER-281:
--------------------------------------

> Assuming that the zk instance is already connected seems reasonable to me. The underlying assumption is that the application which passed the zk instance is responsible for passing a working zk handle. In the case the application passes the zk handle, I'm not sure it is a good idea to have the bk client sort of managing it.

I agreed. My point is not to resolve the passed zk handle in bookkeeper constructor. actually we need to do same thing in BookKeeperAdmin, which is from our code.
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0, 4.2.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (BOOKKEEPER-281) BKClient is failing when zkclient connection delays

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

Ivan Kelly updated BOOKKEEPER-281:
----------------------------------

    Attachment: BOOKKEEPER-281.diff

Tests pass cleanly now. 
                
> BKClient is failing when zkclient connection delays
> ---------------------------------------------------
>
>                 Key: BOOKKEEPER-281
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-281
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>             Fix For: 4.1.0
>
>         Attachments: BOOKKEEPER-281.diff, BOOKKEEPER-281.diff
>
>
> I have started the ZK cluster and when tries to create a BookKeeper client from my application, it is throwing following ZooKeeper ConnectionLossException and is exitting.
> 12/06/01 11:44:31 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> 12/06/01 11:44:31 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
> 12/06/01 11:44:31 INFO zookeeper.ClientCnxn: Client session timed out, have not heard from server in 4540ms for sessionid 0x0, closing socket connection and attempting reconnect
> 12/06/01 11:44:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /10.18.40.91:2182
> Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
>        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
>        at org.apache.bookkeeper.client.BookieWatcher.readBookiesBlocking(BookieWatcher.java:151)
>        at org.apache.bookkeeper.client.BookKeeper.<init>(BookKeeper.java:139)
>        at BKClient1.main(BKClient1.java:40)
> 12/06/01 11:44:36 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
> When analyzed more, the root cause is:
> BookKeeper.java:
> --------------------
> In the constructor of BookKeeper, immediately after creating the ZK client , it is going to bookieWatcher.readBookiesBlocking() for available bookies from ZK server before reaching SyncConnected event.
> I think, we would properly use the existing countdown latch and wait till ZooKeeper client connection establishment before continue reading Bookies.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira