You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@zookeeper.apache.org by "Kezhu Wang (Jira)" <ji...@apache.org> on 2022/06/29 11:07:00 UTC

[jira] [Created] (ZOOKEEPER-4565) Config watch path get truncated abnormally and fail chroot zookeeper client

|  ![](cid:jira-generated-image-avatar-a72cde87-8a09-4eb7-ab04-11791758f85f) |
[Kezhu
Wang](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=kezhuw)
**created** an issue  
---|---  
|  
---  
|  [ZooKeeper](https://issues.apache.org/jira/browse/ZOOKEEPER) /
[![Bug](cid:jira-generated-image-avatar-489c8ba1-8c01-46e7-bbbe-
cf74ace83d93)](https://issues.apache.org/jira/browse/ZOOKEEPER-4565)
[ZOOKEEPER-4565](https://issues.apache.org/jira/browse/ZOOKEEPER-4565)  
---  
[Config watch path get truncated abnormally and fail chroot zookeeper
client](https://issues.apache.org/jira/browse/ZOOKEEPER-4565)  
| Issue Type: |  ![Bug](cid:jira-generated-image-
avatar-489c8ba1-8c01-46e7-bbbe-cf74ace83d93) Bug  
---|---  
Affects Versions: |  3.7.1, 3.8.0, 3.6.3, 3.9.0  
Assignee: |  Unassigned  
Components: |  java client  
Created: |  29/Jun/22 11:06  
Priority: |  ![Major](cid:jira-generated-image-static-major-
ab02b8a3-fcc1-4da9-ac2a-917e0b44013c) Major  
Reporter: |  [Kezhu
Wang](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=kezhuw)  
|

`ClientCnxn` strips off `chrootPath` for notifications. This strip could break
"/zookeeper/config" to illegal zookeeper path(aka. not start with "/") and
fail zookeeper client due to index out of bound exception in
`PathParentIterator.next`.

    
    
                    // convert from a server path to a client path
                    if (chrootPath != null) {
                        String serverPath = event.getPath();
                        if (serverPath.compareTo(chrootPath) == 0) {
                            event.setPath("/");
                        } else if (serverPath.length() > chrootPath.length()) {
                            event.setPath(serverPath.substring(chrootPath.length()));
                         } else {
                             LOG.warn("Got server path {} which is too short for chroot path {}.",
                                 event.getPath(), chrootPath);
                         }
                    }
    

I think we could make this strip similar to c client version `sub_string` and
warns only for not "/zookeeper" nodes.  
  
---  
|  |  [ ![Add Comment](cid:jira-generated-image-static-comment-
icon-c91f37af-c38d-451a-a780-2135aaeea988)
](https://issues.apache.org/jira/browse/ZOOKEEPER-4565#add-comment "Add
Comment") |  [Add
Comment](https://issues.apache.org/jira/browse/ZOOKEEPER-4565#add-comment "Add
Comment")  
---|---  
  
|  This message was sent by Atlassian Jira (v8.20.10#820010-sha1:ace47f9) |  |
![Atlassian logo](https://issues.apache.org/jira/images/mail/atlassian-email-
logo.png)  
---