From hdfs-issues-return-269801-archive-asf-public=cust-asf.ponee.io@hadoop.apache.org Fri Jun 28 19:37:02 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id A61ED18062B for ; Fri, 28 Jun 2019 21:37:01 +0200 (CEST) Received: (qmail 96118 invoked by uid 500); 28 Jun 2019 19:37:01 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 96096 invoked by uid 99); 28 Jun 2019 19:37:01 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Jun 2019 19:37:00 +0000 Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 68C9EE2E3A for ; Fri, 28 Jun 2019 19:37:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 21E9D25814 for ; Fri, 28 Jun 2019 19:37:00 +0000 (UTC) Date: Fri, 28 Jun 2019 19:37:00 +0000 (UTC) From: "Anu Engineer (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HDFS-14618) Incorrect synchronization of ArrayList field (ArrayList is thread-unsafe). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HDFS-14618?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1687= 5184#comment-16875184 ]=20 Anu Engineer commented on HDFS-14618: ------------------------------------- Thanks for the patch. I have assigned this Jira to you. I have also added y= ou to the contributors group, so you will be able to assign JIRAs to your s= elf etc. =C2=A0 > Incorrect synchronization of ArrayList field (ArrayList is thread-unsafe)= . > -------------------------------------------------------------------------= - > > Key: HDFS-14618 > URL: https://issues.apache.org/jira/browse/HDFS-14618 > Project: Hadoop HDFS > Issue Type: Bug > Reporter: Paul Ward > Assignee: Paul Ward > Priority: Critical > Labels: fix-provided, patch-available > Attachments: race.patch > > > I submitted a CR for this issue at: > https://github.com/apache/hadoop/pull/1030 > The field {{timedOutItems}} (an {{ArrayList}}, i.e., not thread safe): > https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hd= fs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/PendingRecon= structionBlocks.java#L70 > is protected by synchronization on itself ({{timedOutItems}}): > https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hd= fs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/PendingRecon= structionBlocks.java#L167-L168 > https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hd= fs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/PendingRecon= structionBlocks.java#L267-L268 > https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hd= fs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/PendingRecon= structionBlocks.java#L178 > However, in one place: > https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hd= fs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/PendingRecon= structionBlocks.java#L133-L135 > it is (trying to be) protected by synchronized using {{pendingReconstruct= ions}} --- but this cannot protect {{timedOutItems}}. > Synchronized on different objects does not ensure mutual exclusion with t= he other locations. > I.e., 2 code locations, one synchronized by {{pendingReconstructions}} an= d the other by {{timedOutItems}} can still executed concurrently. > This CR adds the synchronized on {{timedOutItems}}. > Note that this CR keeps the synchronized on {{pendingReconstructions}}, w= hich is needed for a different purpose (protect {{pendingReconstructions}}) -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org