Return-Path: X-Original-To: apmail-spark-issues-archive@minotaur.apache.org Delivered-To: apmail-spark-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1AD8D1767B for ; Mon, 27 Oct 2014 08:25:35 +0000 (UTC) Received: (qmail 67083 invoked by uid 500); 27 Oct 2014 08:25:34 -0000 Delivered-To: apmail-spark-issues-archive@spark.apache.org Received: (qmail 67051 invoked by uid 500); 27 Oct 2014 08:25:34 -0000 Mailing-List: contact issues-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@spark.apache.org Received: (qmail 67041 invoked by uid 99); 27 Oct 2014 08:25:34 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Oct 2014 08:25:34 +0000 Date: Mon, 27 Oct 2014 08:25:34 +0000 (UTC) From: "Shixiong Zhu (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (SPARK-4097) Race condition in org.apache.spark.ComplexFutureAction.cancel MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/SPARK-4097?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Shixiong Zhu updated SPARK-4097: -------------------------------- Description: There is a chance that `thread` is null when calling `thread.interrupt()`. {code:java} override def cancel(): Unit = this.synchronized { _cancelled = true if (thread != null) { thread.interrupt() } } {code} Should put `thread = null` into a `synchronized` block to fix the race condition. {code:java} try { p.success(func) } catch { case e: Exception => p.failure(e) } finally { thread = null } {code} was: There is a chance that `thread` is null when calling `thread.interrupt()`. {code:scala} override def cancel(): Unit = this.synchronized { _cancelled = true if (thread != null) { thread.interrupt() } } {code} Should put `thread = null` into a `synchronized` block to fix the race condition. {code:scala} try { p.success(func) } catch { case e: Exception => p.failure(e) } finally { thread = null } {code} > Race condition in org.apache.spark.ComplexFutureAction.cancel > ------------------------------------------------------------- > > Key: SPARK-4097 > URL: https://issues.apache.org/jira/browse/SPARK-4097 > Project: Spark > Issue Type: Bug > Components: Spark Core > Affects Versions: 1.1.0 > Reporter: Shixiong Zhu > Priority: Minor > Labels: bug, race-condition > > There is a chance that `thread` is null when calling `thread.interrupt()`. > {code:java} > override def cancel(): Unit = this.synchronized { > _cancelled = true > if (thread != null) { > thread.interrupt() > } > } > {code} > Should put `thread = null` into a `synchronized` block to fix the race condition. > {code:java} > try { > p.success(func) > } catch { > case e: Exception => p.failure(e) > } finally { > thread = null > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org For additional commands, e-mail: issues-help@spark.apache.org