[CORDA-1879]: Ensure Node dies on unrecoverable errors. (#4213)

This commit is contained in:
Michele Sollecito
2018-11-12 15:56:04 +00:00
committed by GitHub
parent ac23fcdf24
commit dc62b20c5d
38 changed files with 83 additions and 282 deletions

View File

@ -220,8 +220,8 @@ object RPCApi {
companion object {
private fun Any.safeSerialize(context: SerializationContext, wrap: (Throwable) -> Any) = try {
serialize(context = context)
} catch (t: Throwable) {
wrap(t).serialize(context = context)
} catch (e: Exception) {
wrap(e).serialize(context = context)
}
fun fromClientMessage(context: SerializationContext, message: ClientMessage): ServerToClient {

View File

@ -160,8 +160,8 @@ class CordaPersistence(
var recoverableFailureCount = 0
fun <T> quietly(task: () -> T) = try {
task()
} catch (t: Throwable) {
log.warn("Cleanup task failed:", t)
} catch (e: Exception) {
log.warn("Cleanup task failed:", e)
}
while (true) {
val transaction = contextDatabase.currentOrNew(isolationLevel) // XXX: Does this code really support statement changing the contextDatabase?
@ -169,7 +169,7 @@ class CordaPersistence(
val answer = transaction.statement()
transaction.commit()
return answer
} catch (e: Throwable) {
} catch (e: Exception) {
quietly(transaction::rollback)
if (e is SQLException || (recoverAnyNestedSQLException && e.hasSQLExceptionCause())) {
if (++recoverableFailureCount > recoverableFailureTolerance) throw e

View File

@ -318,7 +318,7 @@ class X509UtilitiesTest {
lock.notifyAll()
}
sslServerSocket.close()
} catch (ex: Throwable) {
} catch (ex: Exception) {
serverError = true
}
}