Skip to content

Commit

Permalink
Avoid negative sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Or committed May 21, 2015
1 parent f2faa7a commit 56d6e5e
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@ private[spark] class ApplicationMaster(
val currentAllocationInterval =
math.min(heartbeatInterval, nextAllocationInterval)
nextAllocationInterval *= 2
// avoid overflow
nextAllocationInterval = math.min(
nextAllocationInterval, ApplicationMaster.MAX_RM_HEARTBEAT_INTERVAL_MS)
currentAllocationInterval
} else {
nextAllocationInterval = initialAllocationInterval
Expand Down Expand Up @@ -577,6 +580,9 @@ object ApplicationMaster extends Logging {
private val EXIT_SECURITY = 14
private val EXIT_EXCEPTION_USER_CLASS = 15

// cap on heartbeat interval between us and the resource manager
private val MAX_RM_HEARTBEAT_INTERVAL_MS = 10000

private var master: ApplicationMaster = _

def main(args: Array[String]): Unit = {
Expand Down

0 comments on commit 56d6e5e

Please sign in to comment.