mirror of
https://github.com/corda/corda.git
synced 2025-02-21 09:51:57 +00:00
[ENT-2545]: Failing flow sent to Hospital does not log any ERROR's (fixed). (#4015)
This commit is contained in:
parent
149b6034e1
commit
ff9bf68e37
@ -20,6 +20,8 @@ class FinalityHandler(private val sender: FlowSession) : FlowLogic<Unit>() {
|
|||||||
override fun call() {
|
override fun call() {
|
||||||
subFlow(ReceiveTransactionFlow(sender, true, StatesToRecord.ONLY_RELEVANT))
|
subFlow(ReceiveTransactionFlow(sender, true, StatesToRecord.ONLY_RELEVANT))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal fun sender(): Party = sender.counterparty
|
||||||
}
|
}
|
||||||
|
|
||||||
class NotaryChangeHandler(otherSideSession: FlowSession) : AbstractStateReplacementFlow.Acceptor<Party>(otherSideSession) {
|
class NotaryChangeHandler(otherSideSession: FlowSession) : AbstractStateReplacementFlow.Acceptor<Party>(otherSideSession) {
|
||||||
|
@ -218,7 +218,7 @@ class FlowStateMachineImpl<R>(override val id: StateMachineRunId,
|
|||||||
suspend(FlowIORequest.WaitForSessionConfirmations, maySkipCheckpoint = true)
|
suspend(FlowIORequest.WaitForSessionConfirmations, maySkipCheckpoint = true)
|
||||||
Try.Success(result)
|
Try.Success(result)
|
||||||
} catch (throwable: Throwable) {
|
} catch (throwable: Throwable) {
|
||||||
logger.info("Flow threw exception... sending to flow hospital", throwable)
|
logger.info("Flow threw exception... sending it to flow hospital", throwable)
|
||||||
Try.Failure<R>(throwable)
|
Try.Failure<R>(throwable)
|
||||||
}
|
}
|
||||||
val softLocksId = if (hasSoftLockedStates) logic.runId.uuid else null
|
val softLocksId = if (hasSoftLockedStates) logic.runId.uuid else null
|
||||||
|
@ -217,7 +217,11 @@ class StaffedFlowHospital {
|
|||||||
*/
|
*/
|
||||||
object FinalityDoctor : Staff {
|
object FinalityDoctor : Staff {
|
||||||
override fun consult(flowFiber: FlowFiber, currentState: StateMachineState, newError: Throwable, history: MedicalHistory): Diagnosis {
|
override fun consult(flowFiber: FlowFiber, currentState: StateMachineState, newError: Throwable, history: MedicalHistory): Diagnosis {
|
||||||
return if (currentState.flowLogic is FinalityHandler) Diagnosis.OVERNIGHT_OBSERVATION else Diagnosis.NOT_MY_SPECIALTY
|
return (currentState.flowLogic as? FinalityHandler)?.let { logic -> Diagnosis.OVERNIGHT_OBSERVATION.also { warn(logic, flowFiber, currentState) } } ?: Diagnosis.NOT_MY_SPECIALTY
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun warn(flowLogic: FinalityHandler, flowFiber: FlowFiber, currentState: StateMachineState) {
|
||||||
|
log.warn("Flow ${flowFiber.id} failed to be finalised. Manual intervention may be required before retrying the flow by re-starting the node. State machine state: $currentState, initiating party was: ${flowLogic.sender().name}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user