You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Harsh Panchal (Jira)" <ji...@apache.org> on 2021/04/01 09:13:00 UTC

[jira] [Created] (SPARK-34934) Race condition while registering source in MetricsSystem

Harsh Panchal created SPARK-34934:
-------------------------------------

             Summary: Race condition while registering source in MetricsSystem 
                 Key: SPARK-34934
                 URL: https://issues.apache.org/jira/browse/SPARK-34934
             Project: Spark
          Issue Type: Bug
          Components: Spark Core
    Affects Versions: 3.1.1, 2.3.2
            Reporter: Harsh Panchal


{{MetricsSystem}} manages {{mutable.ArrayBuffer}} of metric sources. {{registerSource}} and {{removeSource}} methods are provided to add/remove new source from Metric system. Both these methods are not synchronised. Also, underlying {{mutable.ArrayBuffer}} not being thread safe, unexpected behaviours are possible if called concurrently (in our case, multiple executors registering custom source).

For ex, we got below exception due to race condition
{noformat}
java.lang.ArrayIndexOutOfBoundsException
	at scala.collection.mutable.ResizableArray$class.ensureSize(ResizableArray.scala:104)
	at scala.collection.mutable.ArrayBuffer.ensureSize(ArrayBuffer.scala:48)
	at scala.collection.mutable.ArrayBuffer.$plus$eq(ArrayBuffer.scala:84)
	at org.apache.spark.metrics.MetricsSystem.registerSource(MetricsSystem.scala:157)
{noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org