spring-integrationspring-integration-dsl

Spring Integration flow failing after migration to Spring Integration 6.x failure occurred in gateway sendAndReceive No reply produced by handler


I recently upgraded a project from Spring Integration 5.x to 6.4.4. Everything is working other than one flow setup that is failing and it is hard to see why. (It was working fine before).

It is quite a complex set of flows with an outer flow with a splitter and aggregator. Within that loop it initiates a flow which carries out a number of asynchronous activities with other flows. This subflow eventually finishes successfully, but then errors with the following error:

WARN  o.s.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel -
Reply message received but the receiving thread has exited due to a timeout

The content of the logged message is a valid payload and not an exception.

I scanned the logs and discovered the following logged at some point while the subflow was processing:

DEBUG o.s.integration.gateway.GatewayProxyFactoryBean$MethodInvocationGateway - failure occurred in gateway sendAndReceive: No reply produced by handler 'autoScheduledScenarioGroupFlow.org.springframework.integration.config.ConsumerEndpointFactoryBean#3', and its 'requiresReply' property is set to true.

I can't see anything else logged that would obviously indicate why the outer flow has this issue when the inner flow is successful.

Any ideas how I can track down what is causing this early termination and what configuration/behaviour might have changed between Spring Integration versions that might cause this?


Solution

  • Reply message received but the receiving thread has exited due to a timeout

    That means a reply has arrived to the gateway request too late.

    Indeed, there was a change when we narrowed reply waiting timeout from infinity to just 30 seconds: https://docs.spring.io/spring-integration/reference/configuration/global-properties.html

    The default number of milliseconds for request and reply timeouts in endpoints. Default value is 30 seconds to avoid indefinite blocking. Can be configured to a negative value to restore infinite blocking behavior in endpoints. Since version 6.2.

    And here is respective Migration Guide: https://github.com/spring-projects/spring-integration/wiki/Spring-Integration-6.0-to-6.1-Migration-Guide#do-not-block-by-default