You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by "sonatype-lift[bot] (via GitHub)" <gi...@apache.org> on 2023/04/20 04:27:37 UTC
[GitHub] [zookeeper] sonatype-lift[bot] commented on a diff in pull request #1997: ZOOKEEPER-4689: Fix inaccessible node due to inconsistent ACL index after SNAP sync
sonatype-lift[bot] commented on code in PR #1997:
URL: https://github.com/apache/zookeeper/pull/1997#discussion_r1172067638
##########
zookeeper-server/src/main/java/org/apache/zookeeper/server/ReferenceCountedACLCache.java:
##########
@@ -95,6 +95,19 @@ public synchronized List<ACL> convertLong(Long longVal) {
return acls;
}
+ /**
+ * checks if longval is cached (convertLong can convert it to ACLs).
+ *
+ * @param longVal
Review Comment:
<picture><img alt="9% of developers fix this issue" src="https://lift.sonatype.com/api/commentimage/fixrate/9/display.svg"></picture>
<b>*[EmptyBlockTag](https://google.github.io/styleguide/javaguide.html#s7.1.3-javadoc-block-tags):</b>* A block tag (@param, @return, @throws, @deprecated) has an empty description. Block tags without descriptions don't add much value for future readers of the code; consider removing the tag entirely or adding a description.
---
```suggestion
*
```
---
<details><summary>âšī¸ Expand to see all <b>@sonatype-lift</b> commands</summary>
You can reply with the following commands. For example, reply with ***@sonatype-lift ignoreall*** to leave out all findings.
| **Command** | **Usage** |
| ------------- | ------------- |
| `@sonatype-lift ignore` | Leave out the above finding from this PR |
| `@sonatype-lift ignoreall` | Leave out all the existing findings from this PR |
| `@sonatype-lift exclude <file\|issue\|path\|tool>` | Exclude specified `file\|issue\|path\|tool` from Lift findings by updating your config.toml file |
**Note:** When talking to LiftBot, you need to **refresh** the page to see its response.
<sub>[Click here](https://github.com/apps/sonatype-lift/installations/new) to add LiftBot to another repo.</sub></details>
---
<b>Help us improve LIFT! (<i>Sonatype LiftBot external survey</i>)</b>
Was this a good recommendation for you? <sub><small>Answering this survey will not impact your Lift settings.</small></sub>
[â[đ Not relevant](https://www.sonatype.com/lift-comment-rating?comment=501002535&lift_comment_rating=1)â] - [â[đ Won't fix](https://www.sonatype.com/lift-comment-rating?comment=501002535&lift_comment_rating=2)â] - [â[đ Not critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=501002535&lift_comment_rating=3)â] - [â[đ Critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=501002535&lift_comment_rating=4)â] - [â[đ Critical, fixing now](https://www.sonatype.com/lift-comment-rating?comment=501002535&lift_comment_rating=5)â]
##########
zookeeper-server/src/main/java/org/apache/zookeeper/server/ReferenceCountedACLCache.java:
##########
@@ -95,6 +95,19 @@ public synchronized List<ACL> convertLong(Long longVal) {
return acls;
}
+ /**
+ * checks if longval is cached (convertLong can convert it to ACLs).
+ *
+ * @param longVal
+ * @return true if it's cached.
+ */
+ public synchronized boolean isLongCached(long longVal) {
+ if (longVal == OPEN_UNSAFE_ACL_ID) {
+ return true;
+ }
+ return longKeyMap.containsKey(longVal);
Review Comment:
<picture><img alt="7% of developers fix this issue" src="https://lift.sonatype.com/api/commentimage/fixrate/7/display.svg"></picture>
<b>*THREAD_SAFETY_VIOLATION:</b>* Read/Write race. Non-private method `ReferenceCountedACLCache.isLongCached(...)` reads with synchronization from container `this.longKeyMap` via call to `Map.containsKey(...)`. Potentially races with unsynchronized write in method `ReferenceCountedACLCache.deserialize(...)`.
Reporting because this access may occur on a background thread.
---
<details><summary>âšī¸ Expand to see all <b>@sonatype-lift</b> commands</summary>
You can reply with the following commands. For example, reply with ***@sonatype-lift ignoreall*** to leave out all findings.
| **Command** | **Usage** |
| ------------- | ------------- |
| `@sonatype-lift ignore` | Leave out the above finding from this PR |
| `@sonatype-lift ignoreall` | Leave out all the existing findings from this PR |
| `@sonatype-lift exclude <file\|issue\|path\|tool>` | Exclude specified `file\|issue\|path\|tool` from Lift findings by updating your config.toml file |
**Note:** When talking to LiftBot, you need to **refresh** the page to see its response.
<sub>[Click here](https://github.com/apps/sonatype-lift/installations/new) to add LiftBot to another repo.</sub></details>
---
<b>Help us improve LIFT! (<i>Sonatype LiftBot external survey</i>)</b>
Was this a good recommendation for you? <sub><small>Answering this survey will not impact your Lift settings.</small></sub>
[â[đ Not relevant](https://www.sonatype.com/lift-comment-rating?comment=501003588&lift_comment_rating=1)â] - [â[đ Won't fix](https://www.sonatype.com/lift-comment-rating?comment=501003588&lift_comment_rating=2)â] - [â[đ Not critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=501003588&lift_comment_rating=3)â] - [â[đ Critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=501003588&lift_comment_rating=4)â] - [â[đ Critical, fixing now](https://www.sonatype.com/lift-comment-rating?comment=501003588&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: notifications-unsubscribe@zookeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org