Improve error logging when sending HTTP error response.

Ensure that we include the underlying exception as a root cause so
that our server-side logging includes it. Without this fix we just get
a WebApplicationException and its stacktrace with a null message, the
original exception was being returned to the client but thrown away on
the server side.
Merge pull request #1600 from benbc/2.0-improve-http-error-response

Improve error logging when sending HTTP error response.
Diagnostics for surprising spurious failure.
Make sure thread has started before we observe it.
Fixes quorum check in ElectionState

The quorum check was wrong, leading to instances proceeding to do elections
 even when there were not enough instances left in the cluster, showing
 symptoms of split brain. This adds some tests and a fix for the issue
Fixes and reenables ElectionStateTest.testElectionFromDemoteIsRejectedIfNoQuorum
More stable park detection in lock test.
Fixes slave deadlock problem.

 o Instances now only block access if they were already in a state
   where they allowed access in the first place. This way instances
   won't grab multiple locks on the database, which previously lead
   to the database blocking forever (locked several times, only opened
   once).
 o Refactored out quorum check into a utilty method and replaced incorrect
   majority checks in HighAvailabilityMemberStateMachine and MultiPaxosContext.