mirror of
https://github.com/corda/corda.git
synced 2025-06-14 13:18:18 +00:00
[CORDA-1879]: Ensure Node dies on unrecoverable errors. (#4213)
This commit is contained in:
committed by
GitHub
parent
ac23fcdf24
commit
dc62b20c5d
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -318,7 +318,7 @@ class X509UtilitiesTest {
|
||||
lock.notifyAll()
|
||||
}
|
||||
sslServerSocket.close()
|
||||
} catch (ex: Throwable) {
|
||||
} catch (ex: Exception) {
|
||||
serverError = true
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user