apply pr 494 and 496

@hornairs @honkfestival @bouk @udnay @sayeaud @patrickdonovan and anyone else that's heavy into spark atm.

This applies currently unmerged pr 494 and 496 to our build.

tl:dr;

 - PR 496: Fixes bad dead worker cleanup logic that was discovered during the discussions on PR 494.
 - PR 494: Fix a bug in the handling of registering workers to replace dead workers. The bug made it possible for a worker to fail to register to the master but believe that it was properly registered and thus stopped trying to register. This is why we had workers die and simply not come back even though the process was running on the worker nodes.

for more info:

https://github.com/apache/incubator-spark/pull/494
https://github.com/apache/incubator-spark/pull/496