Skip to content

Commit

Permalink
Use a minimum of 3 dispatcher threads to avoid deadlocks
Browse files Browse the repository at this point in the history
  • Loading branch information
robbinspg committed May 27, 2016
1 parent d5911d1 commit 139e875
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,9 @@ private[netty] class Dispatcher(nettyEnv: NettyRpcEnv) extends Logging {

/** Thread pool used for dispatching messages. */
private val threadpool: ThreadPoolExecutor = {
// Use a minimum of 3 threads to avoid deadlocks
val numThreads = nettyEnv.conf.getInt("spark.rpc.netty.dispatcher.numThreads",
math.max(2, Runtime.getRuntime.availableProcessors()))
math.max(3, Runtime.getRuntime.availableProcessors()))
val pool = ThreadUtils.newDaemonFixedThreadPool(numThreads, "dispatcher-event-loop")
for (i <- 0 until numThreads) {
pool.execute(new MessageLoop)
Expand Down

0 comments on commit 139e875

Please sign in to comment.