spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shixiong Zhu (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SPARK-4097) Race condition in org.apache.spark.ComplexFutureAction.cancel
Date Mon, 27 Oct 2014 08:25:34 GMT

     [ 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


Mime
View raw message