You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/01/13 09:37:44 UTC
[GitHub] [spark] LuciferYang opened a new pull request #35190: [SPARK-37893][TESTS] Avoid ConcurrentModificationException related to SparkFunSuite.LogAppender#_threshold"
LuciferYang opened a new pull request #35190:
URL: https://github.com/apache/spark/pull/35190
### What changes were proposed in this pull request?
When `mvn clean install -pl sql/core -am -Pscala-2.13` is executed, `AdaptiveQueryExecSuite` failed with a very small probability, the error stack as follows:
```
- Logging plan changes for AQE *** FAILED ***
java.util.ConcurrentModificationException: mutation occurred during iteration
at scala.collection.mutable.MutationTracker$.checkMutations(MutationTracker.scala:43)
at scala.collection.mutable.CheckedIndexedSeqView$CheckedIterator.hasNext(CheckedIndexedSeqView.scala:47)
at scala.collection.StrictOptimizedIterableOps.filterImpl(StrictOptimizedIterableOps.scala:225)
at scala.collection.StrictOptimizedIterableOps.filterImpl$(StrictOptimizedIterableOps.scala:222)
at scala.collection.mutable.ArrayBuffer.filterImpl(ArrayBuffer.scala:43)
at scala.collection.StrictOptimizedIterableOps.filterNot(StrictOptimizedIterableOps.scala:220)
at scala.collection.StrictOptimizedIterableOps.filterNot$(StrictOptimizedIterableOps.scala:220)
at scala.collection.mutable.ArrayBuffer.filterNot(ArrayBuffer.scala:43)
at org.apache.spark.SparkFunSuite$LogAppender.loggingEvents(SparkFunSuite.scala:288)
at org.apache.spark.sql.execution.adaptive.AdaptiveQueryExecSuite.$anonfun$new$152(AdaptiveQueryExecSuite.scala:1487)
```
So this pr adds synchronous access control for `SparkFunSuite$LogAppender.loggingEvents` to avoid the above exceptions
### Why are the changes needed?
Bug fix
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Pass GA
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] viirya commented on a change in pull request #35190: [SPARK-37893][TESTS] Avoid ConcurrentModificationException related to SparkFunSuite.LogAppender#_threshold"
Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #35190:
URL: https://github.com/apache/spark/pull/35190#discussion_r784166208
##########
File path: core/src/test/scala/org/apache/spark/SparkFunSuite.scala
##########
@@ -272,19 +272,23 @@ abstract class SparkFunSuite
override def append(loggingEvent: LogEvent): Unit = loggingEvent.synchronized {
val copyEvent = loggingEvent.toImmutable
if (copyEvent.getLevel.isMoreSpecificThan(_threshold)) {
- if (_loggingEvents.size >= maxEvents) {
- val loggingInfo = if (msg == "") "." else s" while logging $msg."
- throw new IllegalStateException(
- s"Number of events reached the limit of $maxEvents$loggingInfo")
+ _loggingEvents.synchronized {
+ if (_loggingEvents.size >= maxEvents) {
+ val loggingInfo = if (msg == "") "." else s" while logging $msg."
+ throw new IllegalStateException(
+ s"Number of events reached the limit of $maxEvents$loggingInfo")
+ }
+ _loggingEvents.append(copyEvent)
}
- _loggingEvents.append(copyEvent)
}
}
def setThreshold(threshold: Level): Unit = {
_threshold = threshold
}
- def loggingEvents: ArrayBuffer[LogEvent] = _loggingEvents.filterNot(_ == null)
+ def loggingEvents: ArrayBuffer[LogEvent] = _loggingEvents.synchronized{
+ _loggingEvents.filterNot(_ == null)
+ }
Review comment:
`_loggingEvents.synchronized { ... }`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] LuciferYang commented on pull request #35190: [SPARK-37893][CORE][TESTS] Avoid ConcurrentModificationException related to SparkFunSuite.LogAppender#_threshold"
Posted by GitBox <gi...@apache.org>.
LuciferYang commented on pull request #35190:
URL: https://github.com/apache/spark/pull/35190#issuecomment-1012718577
It doesn't matter ~ :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dongjoon-hyun edited a comment on pull request #35190: [SPARK-37893][CORE][TESTS] Avoid ConcurrentModificationException related to SparkFunSuite.LogAppender#_threshold"
Posted by GitBox <gi...@apache.org>.
dongjoon-hyun edited a comment on pull request #35190:
URL: https://github.com/apache/spark/pull/35190#issuecomment-1012710793
Until now, I thought `Primary Author` is determined by the number of lines. However, tt turns out that it's just a number of commits.
https://github.com/apache/spark/blob/1ef56e969f42726c630572f4e781cbeb3b57b888/dev/merge_spark_pr.py#L138-L146
More importantly, I didn't pay attention for the follow-up question. My bad. Sorry again, @LuciferYang . Next time, I'll not touch the PR in GitHub.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dongjoon-hyun commented on pull request #35190: [SPARK-37893][CORE][TESTS] Avoid ConcurrentModificationException related to SparkFunSuite.LogAppender#_threshold"
Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on pull request #35190:
URL: https://github.com/apache/spark/pull/35190#issuecomment-1012703926
Thank you all. Merged to master!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] viirya commented on pull request #35190: [SPARK-37893][TESTS] Avoid ConcurrentModificationException related to SparkFunSuite.LogAppender#_threshold"
Posted by GitBox <gi...@apache.org>.
viirya commented on pull request #35190:
URL: https://github.com/apache/spark/pull/35190#issuecomment-1012355219
cc @gengliangwang
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] LuciferYang commented on a change in pull request #35190: [SPARK-37893][CORE][TESTS] Avoid ConcurrentModificationException related to SparkFunSuite.LogAppender#_threshold"
Posted by GitBox <gi...@apache.org>.
LuciferYang commented on a change in pull request #35190:
URL: https://github.com/apache/spark/pull/35190#discussion_r784473891
##########
File path: core/src/test/scala/org/apache/spark/SparkFunSuite.scala
##########
@@ -272,19 +272,23 @@ abstract class SparkFunSuite
override def append(loggingEvent: LogEvent): Unit = loggingEvent.synchronized {
val copyEvent = loggingEvent.toImmutable
if (copyEvent.getLevel.isMoreSpecificThan(_threshold)) {
- if (_loggingEvents.size >= maxEvents) {
- val loggingInfo = if (msg == "") "." else s" while logging $msg."
- throw new IllegalStateException(
- s"Number of events reached the limit of $maxEvents$loggingInfo")
+ _loggingEvents.synchronized {
+ if (_loggingEvents.size >= maxEvents) {
+ val loggingInfo = if (msg == "") "." else s" while logging $msg."
+ throw new IllegalStateException(
+ s"Number of events reached the limit of $maxEvents$loggingInfo")
+ }
+ _loggingEvents.append(copyEvent)
}
- _loggingEvents.append(copyEvent)
}
}
def setThreshold(threshold: Level): Unit = {
_threshold = threshold
}
- def loggingEvents: ArrayBuffer[LogEvent] = _loggingEvents.filterNot(_ == null)
+ def loggingEvents: ArrayBuffer[LogEvent] = _loggingEvents.synchronized{
+ _loggingEvents.filterNot(_ == null)
+ }
Review comment:
Thanks @dongjoon-hyun
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dongjoon-hyun commented on pull request #35190: [SPARK-37893][CORE][TESTS] Avoid ConcurrentModificationException related to SparkFunSuite.LogAppender#_threshold"
Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on pull request #35190:
URL: https://github.com/apache/spark/pull/35190#issuecomment-1012707127
In your branch, the ownership was clean line by line. Let me check the bug in our merge script.
```
7fd361973d2 (Liang-Chi Hsieh 2021-12-23 19:41:02 -0800 272) override def append(loggingEvent: LogEvent): Unit = loggingEvent.synchronized {
7fd361973d2 (Liang-Chi Hsieh 2021-12-23 19:41:02 -0800 273) val copyEvent = loggingEvent.toImmutable
7fd361973d2 (Liang-Chi Hsieh 2021-12-23 19:41:02 -0800 274) if (copyEvent.getLevel.isMoreSpecificThan(_threshold)) {
0e3dcdbd7f1 (yangjie01 2022-01-13 17:22:53 +0800 275) _loggingEvents.synchronized {
0e3dcdbd7f1 (yangjie01 2022-01-13 17:22:53 +0800 276) if (_loggingEvents.size >= maxEvents) {
0e3dcdbd7f1 (yangjie01 2022-01-13 17:22:53 +0800 277) val loggingInfo = if (msg == "") "." else s" while logging $msg."
0e3dcdbd7f1 (yangjie01 2022-01-13 17:22:53 +0800 278) throw new IllegalStateException(
0e3dcdbd7f1 (yangjie01 2022-01-13 17:22:53 +0800 279) s"Number of events reached the limit of $maxEvents$loggingInfo")
0e3dcdbd7f1 (yangjie01 2022-01-13 17:22:53 +0800 280) }
0e3dcdbd7f1 (yangjie01 2022-01-13 17:22:53 +0800 281) _loggingEvents.append(copyEvent)
ca5cabe5fbf (Liang-Chi Hsieh 2021-12-17 21:40:51 -0800 282) }
88fc8dbc09c (Maxim Gekk 2020-01-14 16:03:10 +0900 283) }
88fc8dbc09c (Maxim Gekk 2020-01-14 16:03:10 +0900 284) }
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dongjoon-hyun commented on pull request #35190: [SPARK-37893][CORE][TESTS] Avoid ConcurrentModificationException related to SparkFunSuite.LogAppender#_threshold"
Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on pull request #35190:
URL: https://github.com/apache/spark/pull/35190#issuecomment-1012715794
I'll make a PR to fix the bug.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dongjoon-hyun commented on pull request #35190: [SPARK-37893][CORE][TESTS] Avoid ConcurrentModificationException related to SparkFunSuite.LogAppender#_threshold"
Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on pull request #35190:
URL: https://github.com/apache/spark/pull/35190#issuecomment-1012710793
Until now, I thought `Primary Author` is determined by the number of lines. It turns out that it's just a number of commits.
https://github.com/apache/spark/blob/1ef56e969f42726c630572f4e781cbeb3b57b888/dev/merge_spark_pr.py#L138-L146
More importantly, I didn't pay attention for the follow-up question. My bad. Sorry again, @LuciferYang . Next time, I'll not touch the PR in GitHub.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dongjoon-hyun closed pull request #35190: [SPARK-37893][CORE][TESTS] Avoid ConcurrentModificationException related to SparkFunSuite.LogAppender#_threshold"
Posted by GitBox <gi...@apache.org>.
dongjoon-hyun closed pull request #35190:
URL: https://github.com/apache/spark/pull/35190
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dongjoon-hyun commented on pull request #35190: [SPARK-37893][CORE][TESTS] Avoid ConcurrentModificationException related to SparkFunSuite.LogAppender#_threshold"
Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on pull request #35190:
URL: https://github.com/apache/spark/pull/35190#issuecomment-1012705323
Very sorry, @LuciferYang . The merge script didn't work like this so far. :(
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] LuciferYang commented on pull request #35190: [SPARK-37893][TESTS] Avoid ConcurrentModificationException related to SparkFunSuite.LogAppender#_threshold"
Posted by GitBox <gi...@apache.org>.
LuciferYang commented on pull request #35190:
URL: https://github.com/apache/spark/pull/35190#issuecomment-1011962422
The above UT failure is a very small probability event, cc @viirya
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dongjoon-hyun commented on a change in pull request #35190: [SPARK-37893][TESTS] Avoid ConcurrentModificationException related to SparkFunSuite.LogAppender#_threshold"
Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #35190:
URL: https://github.com/apache/spark/pull/35190#discussion_r784254982
##########
File path: core/src/test/scala/org/apache/spark/SparkFunSuite.scala
##########
@@ -272,19 +272,23 @@ abstract class SparkFunSuite
override def append(loggingEvent: LogEvent): Unit = loggingEvent.synchronized {
val copyEvent = loggingEvent.toImmutable
if (copyEvent.getLevel.isMoreSpecificThan(_threshold)) {
- if (_loggingEvents.size >= maxEvents) {
- val loggingInfo = if (msg == "") "." else s" while logging $msg."
- throw new IllegalStateException(
- s"Number of events reached the limit of $maxEvents$loggingInfo")
+ _loggingEvents.synchronized {
+ if (_loggingEvents.size >= maxEvents) {
+ val loggingInfo = if (msg == "") "." else s" while logging $msg."
+ throw new IllegalStateException(
+ s"Number of events reached the limit of $maxEvents$loggingInfo")
+ }
+ _loggingEvents.append(copyEvent)
}
- _loggingEvents.append(copyEvent)
}
}
def setThreshold(threshold: Level): Unit = {
_threshold = threshold
}
- def loggingEvents: ArrayBuffer[LogEvent] = _loggingEvents.filterNot(_ == null)
+ def loggingEvents: ArrayBuffer[LogEvent] = _loggingEvents.synchronized{
+ _loggingEvents.filterNot(_ == null)
+ }
Review comment:
+1 for @viirya 's comment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dongjoon-hyun commented on pull request #35190: [SPARK-37893][CORE][TESTS] Avoid ConcurrentModificationException related to SparkFunSuite.LogAppender#_threshold"
Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on pull request #35190:
URL: https://github.com/apache/spark/pull/35190#issuecomment-1012704987
Uh, it looks wrong. Something goes wrong during merging via the merge script. I only changed one line here, but it causes the following.
```
Lead-authored-by: Dongjoon Hyun <do...@apache.org>
Co-authored-by: yangjie01 <ya...@baidu.com>
Signed-off-by: Dongjoon Hyun <do...@apache.org>
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org