Port the deadlock-breaking code from bug 25852.
Re-add the log invocations we lost. This does lead to the stale master pid warning getting logged on a different node (the slave node rather than the node that attempted to start the slave) but I doubt we care about that.
Forgot to add a spec
Merge in bug25873