Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-13850

TimSort Comparison method violates its general contract

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.6.0
    • 1.6.2, 2.0.0
    • Shuffle, Spark Core
    • None

    Description

      While running a query which does a group by on a large dataset, the query fails with following stack trace.

      Job aborted due to stage failure: Task 4077 in stage 1.3 failed 4 times, most recent failure: Lost task 4077.3 in stage 1.3 (TID 88702, hadoop3030.prn2.facebook.com): java.lang.IllegalArgumentException: Comparison method violates its general contract!
      	at org.apache.spark.util.collection.TimSort$SortState.mergeLo(TimSort.java:794)
      	at org.apache.spark.util.collection.TimSort$SortState.mergeAt(TimSort.java:525)
      	at org.apache.spark.util.collection.TimSort$SortState.mergeCollapse(TimSort.java:453)
      	at org.apache.spark.util.collection.TimSort$SortState.access$200(TimSort.java:325)
      	at org.apache.spark.util.collection.TimSort.sort(TimSort.java:153)
      	at org.apache.spark.util.collection.Sorter.sort(Sorter.scala:37)
      	at org.apache.spark.util.collection.unsafe.sort.UnsafeInMemorySorter.getSortedIterator(UnsafeInMemorySorter.java:228)
      	at org.apache.spark.util.collection.unsafe.sort.UnsafeExternalSorter.spill(UnsafeExternalSorter.java:186)
      	at org.apache.spark.memory.TaskMemoryManager.acquireExecutionMemory(TaskMemoryManager.java:175)
      	at org.apache.spark.memory.TaskMemoryManager.allocatePage(TaskMemoryManager.java:249)
      	at org.apache.spark.memory.MemoryConsumer.allocatePage(MemoryConsumer.java:112)
      	at org.apache.spark.util.collection.unsafe.sort.UnsafeExternalSorter.acquireNewPageIfNecessary(UnsafeExternalSorter.java:318)
      	at org.apache.spark.util.collection.unsafe.sort.UnsafeExternalSorter.insertRecord(UnsafeExternalSorter.java:333)
      	at org.apache.spark.sql.execution.UnsafeExternalRowSorter.insertRow(UnsafeExternalRowSorter.java:91)
      	at org.apache.spark.sql.execution.UnsafeExternalRowSorter.sort(UnsafeExternalRowSorter.java:168)
      	at org.apache.spark.sql.execution.Sort$$anonfun$1.apply(Sort.scala:90)
      	at org.apache.spark.sql.execution.Sort$$anonfun$1.apply(Sort.scala:64)
      	at org.apache.spark.rdd.RDD$$anonfun$mapPartitionsInternal$1$$anonfun$apply$21.apply(RDD.scala:728)
      	at org.apache.spark.rdd.RDD$$anonfun$mapPartitionsInternal$1$$anonfun$apply$21.apply(RDD.scala:728)
      	at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38)
      	at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:306)
      	at org.apache.spark.rdd.RDD.iterator(RDD.scala:270)
      	at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38)
      	at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:306)
      	at org.apache.spark.rdd.RDD.iterator(RDD.scala:270)
      	at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38)
      	at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:306)
      	at org.apache.spark.rdd.RDD.iterator(RDD.scala:270)
      	at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38)
      	at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:306)
      	at org.apache.spark.rdd.RDD.iterator(RDD.scala:270)
      	at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38)
      	at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:306)
      	at org.apache.spark.rdd.RDD.iterator(RDD.scala:270)
      	at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:66)
      	at org.apache.spark.scheduler.Task.run(Task.scala:89)
      	at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:214)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      
      

      Please note that the same query used to succeed in Spark 1.5 so it seems like a regression in 1.6.

      Attachments

        Issue Links

          Activity

            People

              sameerag Sameer Agarwal
              sitalkedia@gmail.com Sital Kedia
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: