GitHub user ashwinshankar77 opened a pull request: https://github.com/apache/spark/pull/15267
[SPARK-17667] [YARN][WIP]Make locking fine grained in YarnAllocator#enqueueGetLossReasonRequest ## What changes were proposed in this pull request? Following up on the discussion in SPARK-15725, one of the reason for AM hanging with dynamic allocation(DA) is the way locking is done in YarnAllocator. We noticed that when executors go down during the shrink phase of DA, AM gets locked up. On taking thread dump, we see threads trying to get loss for reason via YarnAllocator#enqueueGetLossReasonRequest, and they are all BLOCKED waiting for lock acquired by allocate call. This gets worse when the number of executors go down are in the thousands, and I've seen AM hang in the order of minutes. This patch is created to make the locking little more fine grained by remembering the executors that were killed via AM, and then serve the GetExecutorLossReason requests with that information. This patch is not final. I want to get inputs on how I can go about removing executors from the `executorsKilledByDriver` set. Also if there is a better way to solve this, would be happy to make the changes. ## How was this patch tested? This was tested in our cluster with manually scaling the number of executors to thousands and then shrinking them down to something small, and made sure that we don't see BLOCKED threads stuck at YarnAllocator#enqueueGetLossReasonRequest. You can merge this pull request into a Git repository by running: $ git pull https://github.com/ashwinshankar77/spark SPARK-17667 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/15267.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #15267 ---- commit 859718c95e3864855be98c5d09e74c652eda31b9 Author: Ashwin Shankar <ashan...@netflix.com> Date: 2016-09-27T18:23:52Z Make locking fine grained in YarnAllocator#enqueueGetLossReasonRequest ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org