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

FutureAction.onComplete consumes a thread while waiting for job

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 1.4.0, 1.4.1, 1.5.0, 1.5.1
    • None
    • Scheduler, Spark Core

    Description

      The implementations of the onComplete callback (and, by extension, the callbacks based on it) of FutureAction (SimpleFutureAction and ComplexFutureAction) each consume a thread that blocks waiting for the underlying job(s) to complete. This is unnecessary and is likely to be very surprising to anyone accustomed to the usual behavior of Scala Futures (i.e., that callbacks only occupy threads AFTER the underlying task has completed), and it runs the risk of causing thread starvation for any processes utilizing the same thread pool (especially if scala.concurrent.ExecutionContext.global is used). The implementations can and should be reworked to operate in a non-blocking manner, by modifying the underlying JobWaiter class to expose a non-blocking API, so that the onComplete (as well as onSuccess and onFailure) callbacks only utilize threads while they are actually executing.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              reggert1980 Richard W. Eggert II
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 24h
                  24h
                  Remaining:
                  Remaining Estimate - 24h
                  24h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified