You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "duyu (JIRA)" <ji...@apache.org> on 2019/05/22 14:09:00 UTC
[jira] [Comment Edited] (SPARK-27804) LiveListenerBus#addToQueue :
create multiple AsyncEventQueues under race condition
[ https://issues.apache.org/jira/browse/SPARK-27804?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16845899#comment-16845899 ]
duyu edited comment on SPARK-27804 at 5/22/19 2:08 PM:
-------------------------------------------------------
I didn't.
You say this method is guided with synchronized, why? I didn't see words like '{{synchronized}}'、‘lock’... And it has used CopyOnWriteArrayList which means it is designed to be thread-safe, if it is synchronized, why it doesn't use ArrayList instead?
was (Author: dydeve):
I didn't.
You say this method is guided with synchronized, why? I didn't see words like '{{synchronized}}'、‘lock’... And it has used CopyOnWriteArrayList which means it is designed to be thread-safe, if it is synchronized, why it doesn't use List instead?
> LiveListenerBus#addToQueue : create multiple AsyncEventQueues under race condition
> ----------------------------------------------------------------------------------
>
> Key: SPARK-27804
> URL: https://issues.apache.org/jira/browse/SPARK-27804
> Project: Spark
> Issue Type: Bug
> Components: Spark Core
> Affects Versions: 2.4.3
> Reporter: duyu
> Priority: Major
>
> LiveListenerBus.scala
> {code}
> private[spark] def addToQueue(
> listener: SparkListenerInterface,
> queue: String): Unit = synchronized {
> if (stopped.get()) {
> throw new IllegalStateException("LiveListenerBus is stopped.")
> }
> queues.asScala.find(_.name == queue) match {
> case Some(queue) =>
> queue.addListener(listener)
> case None =>
> // it will create multiple AsyncEventQueues with the same name when run in multi-thread scene and those created AsyncEventQueues will be added to queues
> val newQueue = new AsyncEventQueue(queue, conf, metrics, this)
> newQueue.addListener(listener)
> if (started.get()) {
> newQueue.start(sparkContext)
> }
> queues.add(newQueue)
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org