You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/08/01 12:08:08 UTC

[GitHub] [solr] sonatype-lift[bot] commented on a diff in pull request #943: SOLR-15342: Separate out a SolrJ-Zookeeper module

sonatype-lift[bot] commented on code in PR #943:
URL: https://github.com/apache/solr/pull/943#discussion_r934454511


##########
solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.java:
##########
@@ -67,6 +72,50 @@ public ZkClientClusterStateProvider(String zkHost) {
     this.zkHost = zkHost;
   }
 
+  /**
+   * Create a ClusterState from Json. This method supports legacy configName location
+   *
+   * @param bytes a byte array of a Json representation of a mapping from collection name to the
+   *     Json representation of a {@link DocCollection} as written by {@link
+   *     ClusterState#write(JSONWriter)}. It can represent one or more collections.
+   * @param liveNodes list of live nodes
+   * @param coll collection name
+   * @param zkClient ZK client
+   * @return the ClusterState
+   */
+  @SuppressWarnings({"unchecked"})
+  @Deprecated
+  public static ClusterState createFromJsonSupportingLegacyConfigName(
+      int version, byte[] bytes, Set<String> liveNodes, String coll, SolrZkClient zkClient) {
+    if (bytes == null || bytes.length == 0) {
+      return new ClusterState(liveNodes, Collections.emptyMap());
+    }
+    Map<String, Object> stateMap = (Map<String, Object>) Utils.fromJSON(bytes);

Review Comment:
   💬 30 similar findings have been found in this PR
   
   ---
   
   *THREAD_SAFETY_VIOLATION:*  Unprotected write. Non-private method `ZkClientClusterStateProvider.createFromJsonSupportingLegacyConfigName(...)` indirectly writes to field `noggit.JSONParser.devNull.buf` outside of synchronization.
    Reporting because another access to the same memory occurs on a background thread, although this access may not.
   
   ---
   
   <details><summary><b>Expand here to view all instances of this finding</b></summary><br/>
   
   <div align="center">
   
   | **File Path** | **Line Number** |
   | ------------- | ------------- |
   | solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java | [299](https://github.com/haythemkh/solr/blob/3efe296542ed1da64d516ebd4152aa3b5441ba31/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java#L299)|
   | solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java | [537](https://github.com/haythemkh/solr/blob/3efe296542ed1da64d516ebd4152aa3b5441ba31/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java#L537)|
   | solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java | [1436](https://github.com/haythemkh/solr/blob/3efe296542ed1da64d516ebd4152aa3b5441ba31/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java#L1436)|
   | solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java | [231](https://github.com/haythemkh/solr/blob/3efe296542ed1da64d516ebd4152aa3b5441ba31/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java#L231)|
   | solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java | [1447](https://github.com/haythemkh/solr/blob/3efe296542ed1da64d516ebd4152aa3b5441ba31/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java#L1447)|
   | solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java | [1765](https://github.com/haythemkh/solr/blob/3efe296542ed1da64d516ebd4152aa3b5441ba31/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java#L1765)|
   | solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java | [1244](https://github.com/haythemkh/solr/blob/3efe296542ed1da64d516ebd4152aa3b5441ba31/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java#L1244)|
   | solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java | [2108](https://github.com/haythemkh/solr/blob/3efe296542ed1da64d516ebd4152aa3b5441ba31/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java#L2108)|
   | solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java | [569](https://github.com/haythemkh/solr/blob/3efe296542ed1da64d516ebd4152aa3b5441ba31/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java#L569)|
   | solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java | [1914](https://github.com/haythemkh/solr/blob/3efe296542ed1da64d516ebd4152aa3b5441ba31/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java#L1914)|
   <p> Showing <b>10</b> of <b>30</b> findings. <a href="https://lift.sonatype.com/results/github.com/haythemkh/solr/01G9CHRH0BCZM60GSXJQGFR10C?t=Infer|THREAD_SAFETY_VIOLATION" target="_blank">Visit the Lift Web Console</a> to see all.</p></div></details>
   
   
   
   ---
   
   Reply with *"**@sonatype-lift help**"* for info about LiftBot commands.
   Reply with *"**@sonatype-lift ignore**"* to tell LiftBot to leave out the above finding from this PR.
   Reply with *"**@sonatype-lift ignoreall**"* to tell LiftBot to leave out all the findings from this PR and from the status bar in Github.
   
   When talking to LiftBot, you need to **refresh** the page to see its response. [Click here](https://help.sonatype.com/lift/talking-to-lift) to get to know more about LiftBot commands.
   
   ---
   
   Was this a good recommendation?
   [ [🙁 Not relevant](https://www.sonatype.com/lift-comment-rating?comment=307573340&lift_comment_rating=1) ] - [ [😕 Won't fix](https://www.sonatype.com/lift-comment-rating?comment=307573340&lift_comment_rating=2) ] - [ [😑 Not critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=307573340&lift_comment_rating=3) ] - [ [🙂 Critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=307573340&lift_comment_rating=4) ] - [ [😊 Critical, fixing now](https://www.sonatype.com/lift-comment-rating?comment=307573340&lift_comment_rating=5) ]



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org