You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "LiuGuH (via GitHub)" <gi...@apache.org> on 2023/10/08 08:52:46 UTC
Re: [PR] HDFS-17024. Potential data race introduced by HDFS-15865. [hadoop]
LiuGuH commented on code in PR #5687:
URL: https://github.com/apache/hadoop/pull/5687#discussion_r1349654905
##########
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DataStreamer.java:
##########
@@ -916,7 +917,7 @@ void waitForAckedSeqno(long seqno) throws IOException {
try (TraceScope ignored = dfsClient.getTracer().
newScope("waitForAckedSeqno")) {
LOG.debug("{} waiting for ack for: {}", this, seqno);
- int dnodes = nodes != null ? nodes.length : 3;
+ int dnodes = nodes.length > 0 ? nodes.length : 3;
Review Comment:
The nodes are not thread-safe. So int currentNodes = nodes.length will maybe NPE.
Use thread-safe data structures or a lock?
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org