From 70b2a94fda4e1b4f4ee7aff2e369d87fb1c9f7f5 Mon Sep 17 00:00:00 2001 From: Dan Newton Date: Tue, 16 Jul 2019 11:31:37 +0100 Subject: [PATCH] ENT-3504 Do not throw exception for missing fiber and log instead - OS version (#5292) Change to `SingleThreadedStateMachineManager`. Instead of throwing an exception when a flow's fiber cannot be found, just log the message at info level. --- .../statemachine/SingleThreadedStateMachineManager.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/node/src/main/kotlin/net/corda/node/services/statemachine/SingleThreadedStateMachineManager.kt b/node/src/main/kotlin/net/corda/node/services/statemachine/SingleThreadedStateMachineManager.kt index e872d60fde..7ce692d679 100644 --- a/node/src/main/kotlin/net/corda/node/services/statemachine/SingleThreadedStateMachineManager.kt +++ b/node/src/main/kotlin/net/corda/node/services/statemachine/SingleThreadedStateMachineManager.kt @@ -448,12 +448,12 @@ class SingleThreadedStateMachineManager( } } else { // It happens when flows restart and the old sessions messages still arrive from a peer. - logger.info("Cannot find flow corresponding to session ID $recipientId.") + logger.info("Cannot find flow corresponding to session ID - $recipientId.") } } else { - val flow = mutex.locked { flows[flowId] } - ?: throw IllegalStateException("Cannot find fiber corresponding to ID $flowId") - flow.fiber.scheduleEvent(Event.DeliverSessionMessage(sessionMessage, deduplicationHandler, sender)) + mutex.locked { flows[flowId] }?.run { + fiber.scheduleEvent(Event.DeliverSessionMessage(sessionMessage, deduplicationHandler, sender)) + } ?: logger.info("Cannot find fiber corresponding to flow ID $flowId") } } catch (exception: Exception) { logger.error("Exception while routing $sessionMessage", exception)