Q:

Lost executor Spark

I have a long running job on Spark, which after running for hours failed with the following errors. 
18/10/09 03:22:15 ERROR YarnScheduler: Lost executor 547 on ip: Unable to create executor due to Unable to register with external shuffle server due to : java.util.concurrent. TimeoutException: Timeout waiting for task. 
18/10/09 03:22:15 WARN TaskSetManager: Lost task 750.0 in stage 19.0 (TID 1565492, ip, executor 547): ExecutorLostFailure (executor 547 exited caused by one of the running tasks) Reason: Unable to create executor due to Unable to register with external shuffle server due to : java.util.concurrent. TimeoutException: Timeout waiting for task. 
18/10/09 03:22:15 WARN TaskSetManager: Lost task 752.0 in stage 19.0 (TID 1565494, ip, executor 547): ExecutorLostFailure (executor 547 exited caused by one of the running tasks) Reason: Unable to create executor due to Unable to register with external shuffle server due to : java.util.concurrent. TimeoutException: Timeout waiting for task. 
18/10/09 03:22:15 WARN TaskSetManager: Lost task 751.0 in stage 19.0 (TID 1565493, ip, executor 547): ExecutorLostFailure (executor 547 exited caused by one of the running tasks) Reason: Unable to create executor due to Unable to register with external shuffle server due to : java.util.concurrent. TimeoutException: Timeout waiting for task. 
18/10/09 03:22:15 WARN TaskSetManager: Lost task 754.0 in stage 19.0 (TID 1565496, ip, executor 547): ExecutorLostFailure (executor 547 exited caused by one of the running tasks) Reason: Unable to create executor due to Unable to register with external shuffle server due to : java.util.concurrent. TimeoutException: Timeout waiting for task. 
18/10/09 03:22:15 WARN TaskSetManager: Lost task 753.0 in stage 19.0 (TID 1565495, ip, executor 547): ExecutorLostFailure (executor 547 exited caused by one of the running tasks) Reason: Unable to create executor due to Unable to register with external shuffle server due to : java.util.concurrent. TimeoutException: Timeout waiting for task. 
18/10/09 03:22:15 ERROR YarnScheduler: Lost executor 572 on ip: Unable to create executor due to Unable to register with external shuffle server due to : java.util.concurrent. TimeoutException: Timeout waiting for task. 
18/10/09 03:22:15 INFO DAGScheduler: Executor lost: 547 (epoch 45)
18/10/09 03:22:15 WARN TaskSetManager: Lost task 756.0 in stage 19.0 (TID 1565498, ip, executor 572): ExecutorLostFailure (executor 572 exited caused by one of the running tasks) Reason: Unable to create executor due to Unable to register with external shuffle server due to : java.util.concurrent. TimeoutException: Timeout waiting for task. 
...

The strange thing is, I can't even see the lost executors on the Executor list for the log.  
It would be great if someone can help fix the problem. 

A:

There are many factors for this to happen but the summary is the following:
Your master node is unable to reply to a specific executor and therefore gives the error 

Unable to register with external shuffle server due to

Why your master node is unable to reply can be of different reasons.  Depends on how your code is structured, the size of your instance if you are using EMR.  
To solve it

Increase your master node.  For example, if you are using i3.4xlarge, instead use i3.8xlarge or even i3.16xlarge. 
Increase the network timeout from 2 minutes to 5 minutes.  This is done with the following spark configuration: spark.network.timeout=300
Increase both the memory and number of cores of your master node.  To increase the number of cores of your master node, set the following configuration.  spark.yarn.am.cores=3

Hope this solves the issue. 